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

what is the difference between truncate and drop statements? : Sql dba

554


what is oltp (online transaction processing)? : Sql dba

532


what is error ora-03113: end-of-file on communication channel?

603


Is truncate ddl or dml?

545


How does a covering index work?

529






What kind of join is join?

559


how would you write a query to select all teams that won either 2, 4, 6 or 8 games? : Sql dba

773


what is isam? : Sql dba

572


what is the command used to fetch first 5 characters of the string? : Sql dba

1134


What is attribute indicator in pl sql?

524


What is a database? Explain

595


Does asenumerable execute the query?

603


Does execute immediate commit?

700


What is pl sql block structure?

543


Is sql pronounced sequel or sql?

739