Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Pl/SQL query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-03 : 09:58:55
Sriram writes "I am writing Pl/SQL block to back up some tables iteratively.

set serveroutput on
accept test_id prompt 'Enter the test id for the back up: '
DECLARE
cursor c1 is select table_name from mnthly_payroll_tables;
table_name varchar2(30);
test_id varchar2(3);
cr_str varchar2(1000);
BEGIN
OPEN c1;
LOOP
FETCH c1 into table_name;
EXIT WHEN c1%NOTFOUND;
dbms_output.put_line(table_name);
cr_str := 'CREATE TABLE '||table_name||'_BAK_'||'&&test_id'||' as select * from '||table_name;
EXEC_DDL(cr_str);
END LOOP;
CLOSE c1;
END;

Here Exec_DDL is a stored procedure that parses the statement and executes it. Now I would also like the PL/SQL block to display the rwo count of the table it has just backed up.

How do I do that?"
   

- Advertisement -