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 / 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 |
Is sqlexception checked or unchecked?
How do I view a procedure in sql?
What is a nested table in word?
What are the different types of triggers?
define different types of trigger. : Sql dba
How many functions are there in sql?
Is sql harder than python?
What is trigger explain it?
How do you sort in sql?
Which is better cte or subquery?
Is there any problem if we use commit repeatedly after each dml statement in a plsq procedure ? (eg. there are 10 update stmt and using 10 commit stmt after each update stmt)
How does sql developer connect to oracle database?