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

Explain enable novalidate constraint.

594


what are actual and formal parameters?

595


when we are importing items in inventory, showing errors, Oracle support suggested us for running scripts & also suggested if we run scripts, iprocurement applicaation if is there it will show shared and if we go in future for iprocurement, it wont work. So kinldy suggest any functional solution.

1467


How to rename a column in an existing table?

614


I have a table called 'test' on source and target with same name, structure and data type but in a different column order. How can you setup replication for this table?

620






How can Oracle users be audited?

601


How to run create database statement?

567


How to check the oracle tns settings?

571


Explain about your project and its relation to the current job position you are applying to?

538


How to write date and time literals in oracle?

554


How to use existing values in update statements using oracle?

545


How to do a full database export?

629


How does oracle handle read consistency?

673


How to convert character types to numeric types?

572


What is bulk load in oracle?

589