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

How to define a variable to match a table column data type?

580


How to define a record variable to store a table row?

579


Explain the use of analyse option in exp command.

590


What is a sub query? Describe its types?

549


What is literal?

589






How to update values on multiple rows in oracle?

602


What are the various oracle database objects?

682


How to convert a date to char in oracle? Give one example.

590


types of indexes and the rationale behind choosing a particular index for a situation.

1986


How to start a specific oracle instance?

584


How to write date and time interval literals in oracle?

575


Can we create trigger on materialized view in oracle?

567


How can you tell how much space is left on a given file system and how much space each of the file systems subdirectories take-up?

2395


How to use select statement to count the number of rows in oracle?

557


Where do we use decode and case statements?

563