Search
 
SCRIPT & CODE EXAMPLE
 

SQL

oracle invalid table name

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)
Comment

PREVIOUS NEXT
Code Example
Sql :: dynamic sql invalid table name 
Sql :: sql insert inserted id 
Sql :: xml path sql server 
Sql :: Copy Table from SQL to CSV 
Sql :: sql decimal to 2 places 
Sql :: add column not null with default value postgres 
Sql :: mysql docker compose 
Sql :: nosql databases list 
Sql :: insert query in ci 
Sql :: oracle saurce code 
Sql :: list all the tables in sql 
Sql :: sql not null 
Sql :: sql calculate percentage 
Sql :: psql connect as user with password 
Sql :: order by oracle 
Sql :: mysql query first character 
Sql :: float precision in psql 
Sql :: install mysql workbench ubuntu 20.04 
Sql :: grant all privileges on a db 
Sql :: give a column name to values generated from case statement in sql 
Sql :: count columns psql(PostreSQL) 
Sql :: psql fatal database does not exist 
Sql :: display 2 numbers after decimal mysql 
Sql :: postgresql casting integer to string 
Sql :: multiple count in sql 
Sql :: sql alter type of column 
Sql :: get record which is available in one table but not in another mysql 
Sql :: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client vs code 
Sql :: how to calculate number of days between two dates excluding weekends in oracle 
Sql :: sql date format 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =