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
How to generate query output in html format?
What is the difference between PFILE and SPFILE in Oracle?
What privilege is needed for a user to query tables in another schema?
Explain about integrity constraint?
Tab A A B ------ 1 A 2 B 3 C Tab B A B ----- 4 D 5 E 6 F Generate the value into B table from A table. Only table A has the value. Write the SQL query to get B table value.
What do you understand by a database object?
What is sequence?
What is difference between sid and service name in oracle?
What is the database name in oracle?
What is a table index in oracle?
What is the meaning of recursive hints in oracle?
What is columnar storage what is the advantage?
How remove data files before opening a database?
How to see free space of each tablespace?
How to retrieve data from an explicit cursor?