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
How do you sort in sql?
What is meant by user defined function?
What is sql partition function?
Is primary key clustered or nonclustered?
Which column in the user.triggers data dictionary view shows that the trigger is a pl/sql trigger?
Could you please provide oca (oracle 10g) dumps for my certification ?
what are all the common sql function? : Sql dba
What is use of package in pl sql?
what is “go” in t-sql? : Transact sql
How do I remove duplicates in two columns?
How to Execute a Package in PL/SQL.?
how do you control the max size of a heap table? : Sql dba
What are the various levels of constraints?
How to create a menu in sqlplus or pl/sql?
What is the use of count (*) in sql?