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 does pl sql work?

520


How can you get sql*loader to commit only at the end of the load file? : aql loader

547


How many developers work on postgresql?

559


What is the difference between execution of triggers and stored procedures?

548


column A column b | output 10 7 | 10 5 8 | 8 7 -9 | 7 3 5 | 5 0 6 | 6 Write a sql query to print such output.

6065






Does truncate require commit?

539


What is the size of partition table?

546


What is gpt format?

499


What is an inner join sql?

542


Differentiate pl/sql and sql?

557


Why are sql stored procedures used?

611


How many types of privileges are available in sql?

735


What are the types of join in sql?

514


What is identity column in sql server?

523


what is innodb? : Sql dba

571