can a table has a column that has only view data and in
other columns we can change data?

Answer Posted / hari kanth

ya,we can create trigger on that table
like as follows
CREATE OR REPLACE TRIGGER key_gen
BEFORE INSERT ON <table_name>
FOR EACH ROW
DECLARE
v_num NUMBER(5);
BEGIN
SELECT seq.nextval INTO v_num from dual;
:new.id:=SAM||LPAD(v_num,3,0);
END;

the <table_name> structure like as follows
(id VARCHAR2(20),
name VARCHAR2(15)
)
now you can just add the records like as follows
INSERT INTO <table_name>
(
name
)
VALUES
(
'&Name'
);
then trigger will fires and automatically it will inserts
into that table with out our knowledge.

NOTE:here "seq" is forward sequence.if it start with 1 and
incremented by 1 then the output will be like as follows

select * from <table_name>

id name

SAM001 TV
SAM002 LCD

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a trigger and what are its types in oracle?

618


How to drop an index in oracle?

703


What is the difference between sharding and replication?

566


How do you store pictures in a database?

657


How to create a new view in oracle?

714






How to define an anonymous block?

712


If youre unsure in which script a sys or system-owned object is created, but you know its in a script from a specific directory, what UNIX command from that directory structure can you run to find your answer?

1730


Can we connect to ORACLE db using Windows Authentication?

801


What is oracle join syntax?

639


What is where clause in oracle?

628


Please explain compound trigger in oracle?

672


What is recovery manager in Oracle?

678


How to best split csv strings in oracle 9i?

684


Explain the use of grant option in imp command.

659


What is a cursor and what are the steps need to be taken?

677