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
What is a trigger and what are its types in oracle?
How to drop an index in oracle?
What is the difference between sharding and replication?
How do you store pictures in a database?
How to create a new view in oracle?
How to define an anonymous block?
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?
Can we connect to ORACLE db using Windows Authentication?
What is oracle join syntax?
What is where clause in oracle?
Please explain compound trigger in oracle?
What is recovery manager in Oracle?
How to best split csv strings in oracle 9i?
Explain the use of grant option in imp command.
What is a cursor and what are the steps need to be taken?