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

How many types of triggers exist in pl/sql?

0 Answers  


What view means?

0 Answers  


What is natural join in sql?

0 Answers  


Which function is used to return remainder in a division operator in sql?

0 Answers  


What packages(if any) has oracle provided for use by developers?

1 Answers  






Is it possible to read/write files to-and-from PL/SQL?

0 Answers  


Can we debug stored procedure?

0 Answers  


what is an execution plan? When would you use it? How would you view the execution plan? : Sql dba

0 Answers  


What is difference between sql and mysql?

0 Answers  


How do you delete duplicates in sql query using rowid?

0 Answers  


Table Order_Name has a column Order_Date which gives the date & Time at which the order is passed.Find the table to write a query to find out the latest order.

5 Answers   Thomson,


Where can I learn sql for free?

0 Answers  


Categories