can a table has a column that has only view data and in
other columns we can change data?
Answers were Sorted based on User's Feedback
Answer / thiru
Yes. We can build a sequence generator value to a column in
a table then next columns can be handled with SQL queries.
Is This Answer Correct ? | 1 Yes | 2 No |
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 |
how to find count rows in table without count function?
What is a Garbage Collection? and what is full recursive Garbage collection?
select * from emp what happened internally when we write this query in the sql prompt?
What is the function of Redo Log ?
How to create additional tablespaces for an new database?
What is difference between sid and service name in oracle?
what are the things that you consider while creating indexes on partitioning tables?
What's dateware house and what's clustor with practicle example
What are the data types in oracle?
How to use windows user to connect to the server?
two tables are there emp(eno,ename,sal,deptno),dept(deptno,dname).how form the query in deptno,ename,max(sal)
Can we use bind variables in oracle stored procedure?