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


Please Help Members By Posting Answers For Below Questions

How is data stored in sql?

722


Is mariadb nosql?

764


what are the other commands to know the structure of table using mysql commands except explain command? : Sql dba

745


How is sql used in oracle?

751


Can we enter data in a table in design view?

707






What is trigger in flip flop?

724


How many clustered indexes can you have?

726


What does select * from mean in sql?

2527


What does the argument [or replace] do?

803


What is the best sql course?

710


How global cursor can be declare with dynamic trigger ?

1938


How many types of cursors supported in pl/sql?

790


Which data dictionary views have the information on the triggers that are available in the database?

938


What is difference between pls_integer and integer?

699


What does select top 1 do in sql?

722