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
What does pl sql developer do?
Show the two pl/sql cursor exceptions.
What is meaning of <> in sql?
What do you understand by pl/sql records?
How many times can we commit in a loop?
Does execute immediate commit?
What do you mean by stored procedures? How do we use it?
What is crud sql?
What is the reports view in oracle sql developer?
What is inner join in sql?
what are the advantages of mysql in comparison to oracle? : Sql dba
what is the difference between sql and t-sql? : Transact sql
what is a trigger in mysql? : Sql dba
What is bind reference and how can it be created?
how does a local variable is defined using t-sql? : Transact sql