Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create or replace procedure getproductdetails(p_colname varchar2, p_value number)
- is
- v_column_exists number :=0;
- cursor c1 is select * from product where p_colname = p_value;
- myrow c1%rowtype;
- BEGIN
- select count(*) into v_column_exists
- from user_tab_cols
- where column_name = p_colname and table_name = 'PRODUCT';
- if(v_column_exists > 0) then
- open c1;
- loop
- fetch c1 into myrow;
- exit when c1%notfound;
- dbms_output.put_line(myrow.prod_name || ' ' || myrow.prod_cost);
- end loop;
- else
- dbms_output.put_line('Column Not Found');
- end if;
- end getproductdetails;
Add Comment
Please, Sign In to add comment