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 can you use check constraints for self referential integrity?
How to get maxsal , minsal, ename department wise in single query
What are the attributes of the cursor?
How do I know if oracle is installed on windows?
what is the use of triggers in Java program? I mean where do we use triggers in Java programming?
How to view the tablespaces in the current database?
What happens if you lost a data file?
How to create a table index in oracle?
What happens in oracle commit?
Assuming today is Monday, how would you use the DBMS_JOB package to schedule the execution of a given procedure owned by SCOTT to start Wednesday at 9AM and to run subsequently every other day at 2AM.
What is an oracle and why it is used?
What is SQL access advisor in Oracle?
What is Undo Management Advisor in Oracle?
Give the various rollback segment states.
Explain about your project and its relation to the current job position you are applying to?