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

Is sql scripting language?

0 Answers  


need to split a string into seperate values. eg. col1 col2 ---------- 100 - 'a,b,c' 200 - 'a,x,b,d,e' 300 - 'c' result: value count ------------- a - 2 b - 1 c - 2 etc.

1 Answers  


If a View on a single base table is manipulated will the changes be reflected on the base table?

5 Answers  


What are triggers and its uses?

0 Answers  


Is nosql faster than sql?

0 Answers  






How to take user input in pl sql?

0 Answers  


What does sign mean sql?

0 Answers  


write a query find which rows of a table is updated on 2 days before?

3 Answers   TCS,


What is the difference between having clause and where clause?

0 Answers  


wt is the diff b/w greast and max ,least and min? wt is the diff b/w case and decod?

4 Answers   Oracle, TCS, Tecnics,


what is indexing, searching and user interface?

1 Answers   HCL,


What does “select count(*) from tab” result?

15 Answers   IBM, Student, Wipro,


Categories