-
HI,
This is the procedure I used for populating the static tables.
Instead of table_name as constant. Use it as parameter.
procedure rows_selected_cur
is
table_name1 VARCHAR2(50) :='Pal_states';
st_id1 varchar2(2) := 'AK' ;
sql_stmt varchar2(80) :='';
where_condition varchar2(80) :='';
emp_rec pal_states%rowtype;
TYPE EmpCurTyp IS REF CURSOR; -- define weak REF CURSOR type
emp_cv EmpCurTyp; -- declare cursor variable
BEGIN
--test_id :='NJ';
-- open cursor variable
where_condition := ' WHERE ST_ID = ''' || st_id1 || '''' ;
where_condition := '';
sql_stmt := 'SELECT * FROM ' || table_name1 || where_condition;
dbms_output.put_line(sql_stmt );
OPEN emp_cv FOR sql_stmt; -- INTO emp_rec; --USING st_id1;
loop
fetch emp_cv into emp_rec;
--dbms_output.put_line ('Sql_row_count ' || emp_cv%ROWCOUNT);
exit when emp_cv%notfound;
end loop;
dbms_output.put_line ('Sql_row_count ' || emp_cv%ROWCOUNT);
close emp_cv;
--dbms_output.put_line (emp_rec.st_desc);
end;
Hope this helps.
Thanks.
GD_1976.
-
gee thanx a lot GD..it worked....lol atlast!!!
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|