ex: take one schema in that t1,t2,.....tn tables and you
don't no the table name also.
write a procedure if enter columns name then display the
maching columns .otherwise display the unmatch columns.
Answer Posted / rajesh venati
create or replace procedure pro(cname in varchar2)
is
n number:=0;
cursor ecur is select column_name from user_tab_columns;
begin
for i in ecur loop
if i.column_name=cname then
n:=n+1;
end if;
end loop;
if n>=1 then
dbms_output.put_line('column matched');
else
dbms_output.put_line('column unmatched');
end if;
end;
-----------------------------------------------------
SQL> exec pro('EMPNO');
column matched
PL/SQL procedure successfully completed.
SQL> EXEC PRO('RAJESH');
column unmatched
PL/SQL procedure successfully completed.
SQL> EXEC PRO('DEPTNO');
column matched
PL/SQL procedure successfully completed.
SQL> EXEC PRO('HISAL');
column matched
PL/SQL procedure successfully completed.
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
Explain what is a subquery ?
What is int identity in sql?
How to install oracle sql developer?
What is the use of index in sql?
What type of join is sql join?
What is a sql statement?
What is a database trigger?
Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?
What are the advantages of pl sql over sql?
What is program debugging?
Can we have two clustered index on a table?
Can one improve the performance of sql*loader? : aql loader
Does sql*plus also have a pl/sql engine?
Hi am new to PLSQL & facing problems in writing code like in SP, Functions, so any one having some SP coding with in depth explanation please share with me my Email ID suvarnaatsuvarna@rediffmail.com Or taking tanning on this please do contact me
How do I view tables in mysql?