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.



ex: take one schema in that t1,t2,.....tn tables and you don't no the table name also. write ..

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

Post New Answer

More SQL PLSQL Interview Questions

What is the use of non clustered index?

0 Answers  


in a package one procedure is wrong package shows valid or not

4 Answers  


Explain raise_application_error.

0 Answers  


How do you bind variables in pl sql?

0 Answers  


How do I save the results of sql query in a file?

0 Answers  






difference between pl/sql table and normal pl/sql table

2 Answers  


What is a natural join?

0 Answers  


Can we update views in sql?

0 Answers  


What are pl/sql packages?

0 Answers  


Describe different types of general function used in sql?

0 Answers  


What is Histogram?

0 Answers   NIIT,


What are Nested Tables? How will u delete 5 rows from Nested Tables

3 Answers   IBM,


Categories