Search
 
SCRIPT & CODE EXAMPLE
 

SQL

ORA-00903: 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 :: view t-sql mail configuration 
Sql :: sqlite drop table 
Sql :: drop all procedures sql server 
Sql :: how to check xampp mysql password 
Sql :: mysql select another database 
Sql :: postgres database sizes 
Sql :: select from describe sql 
Sql :: python how escape sql 
Sql :: sql server obtener fecha en formato dd/mm/yyyy 
Sql :: oracle source code 
Sql :: sql select max value from multiple rows 
Sql :: date formats in sql server 
Sql :: delete record mysql query 
Sql :: alter table add column forigen key mysql 
Sql :: delete temp table if exists 
Sql :: mysql select where starts with 
Sql :: mssql disable foreign key constraint 
Sql :: sql first character 
Sql :: mysql get year from date 
Sql :: how to use group_concat in sql server 
Sql :: sqlite woth cmake 
Sql :: add primary key with auto increment sql server 
Sql :: cheatsheet for sql 
Sql :: mysql update column default value CURRENT_TIMESTAMP error 
Sql :: create a view in sqlite 
Sql :: add column text sql after column 
Sql :: ms sql print from new line 
Sql :: create database sql 
Sql :: select last 30 days sql 
Sql :: default constraint in ms sql 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =