1、代码:
1 DECLARE 2 v_sql VARCHAR2(100) := 'create table t(id varchar2(100))'; 3 v_id VARCHAR2(100); 4 v_table_name VARCHAR2(30) := dbms_random.string('l', 10); 5 BEGIN 6 NULL; 7 v_sql := 'create table ' || v_table_name || '(id varchar2(100))'; 8 dbms_output.put_line(v_table_name); 9 EXECUTE IMMEDIATE v_sql; 10 EXECUTE IMMEDIATE 'INSERT INTO ' || v_table_name || 11 ' SELECT sys_guid() FROM dual'; 12 EXECUTE IMMEDIATE 'SELECT id from ' || v_table_name 13 INTO v_id; 14 dbms_output.put_line(v_id); 15 EXECUTE IMMEDIATE 'DROP TABLE ' || v_table_name; 16 17 END;