That is because you cannot use bind arguments to pass the names of schema objects to a dynamic SQL statement.
Instead, you must embed parameters in the dynamic string, then pass the names of schema objects to those parameters.
-- e.g.
table_name := 'EXAMPLE';
-- dont use:
stmt := 'DROP TABLE :name CASCADE CONSTRAINTS';
EXECUTE IMMEDIATE stmt USING table_name;
-- instead use:
stmt := 'DROP TABLE ' || table_name || ' CASCADE CONSTRAINTS';
EXECUTE IMMEDIATE stmt;
-- or
EXECUTE IMMEDIATE 'DROP TABLE ' || table_name || 'CASCADE CONSTRAINTS';
Source: https://docs.oracle.com/cd/B10500_01/appdev.920/a96624/11_dynam.htm#13947
-- (Making Procedures Work on Arbitrarily Named Schema Objects)
Code Example |
---|
Sql :: Select last row from SQL Table |
Sql :: psql connect |
Sql :: How to convert Varchar to Double in sql? |
Sql :: Insert from table tsql |
Sql :: show procedures mysql |
Sql :: grant all privileges mysql |
Sql :: print all records of table in mysql |
Sql :: datepart postgres |
Sql :: incorrect string value: mysql |
Sql :: query saurce oracle |
Sql :: select table column name in sql |
Sql :: can you update NULL in sql |
Sql :: sql server pagination limit |
Sql :: date format in sql |
Sql :: mysql show attributes of a table |
Sql :: date diff sql |
Sql :: locate sql server |
Sql :: mysql CAST(amount as float) |
Sql :: how to check if a row is null in sql |
Sql :: postgresql create user |
Sql :: c# sql select |
Sql :: backup a table in sql |
Sql :: sql cheat sheet pdf |
Sql :: how to delete user in mysql |
Sql :: apex set debug level |
Sql :: date format in postgresql |
Sql :: sql server output parameter |
Sql :: sql server backup table |
Sql :: mysql store ip address |
Sql :: alter table add multiple columns postgresql |