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 'mysqld'? : Sql dba

0 Answers  


write a query filter the null value data following source? name age john 30 smith null null 24 sharp 35 i want output name age john 30 sharp 35

1 Answers   TCS,


What is bitemporal narrowing?

0 Answers  


What are the types of keys?

0 Answers  


What is the advantage of index in sql?

0 Answers  






What is not null in sql?

0 Answers  


what is the difference between cluster and non cluster index? : Sql dba

0 Answers  


What is the difference between nested table and varray?

0 Answers  


What is nvarchar max in sql?

0 Answers  


What is the usage of sql functions?

0 Answers  


Write a query to display the current date in sql?

0 Answers  


difference between table level constraint and column level and advantages of table level constraint

4 Answers   Doyensys,


Categories