COLUMN sub_script_col NEW_VALUE sub_script DEFINE sub_script = do.nothing.sql SELECT 'create_fubar.sql' AS sub_script_col FROM user_tables WHERE table_name = 'FUBAR' ; @&sub_script
Petri BR wrote:Yes, that would be better if it were possible, but, unfotunately, I don't think there is a way to do it in a single SQL*Plus script.
... I'll try that solution, but I'd like to make a solution in a sigle file.
(I haven't tested the above - just giving it as an idea you might work with if you really need it ;-) )
declare test_table_name user_tables.table_name%type; begin select table_name into test_table_name from user_tables where table_name = 'FUBAR'; exception when no_data_found then execute immediate q'[ create table fubar ( col1 number ) ]'; end; /
Try to do the creation - if it raises ORA-00955 then the table already did exist and the error can be ignored.
begin execute immediate q'[ create table fubar ( col1 number ) ]'; exception when others then if sqlcode = -955 then null; --object already exists else raise; end; end; /