I am trying to run a stored procedure stored in Teradata database using python script. Teradata ODBC is connected in 'Teradata' mode. Still I am getting the following error:
3932 :Only an ET or null statement is legal after a DDL Statement
The Stored procedure does not have 'ET' between DML and DDL in my stored procedure.
I do not have access to modify the stored procedure.
When I call th eprocedure in SQL Editor, it runs absolutely fine.
Any help will be greatly appreciatd.
Thank you!
Related
I am using OracleOperator to execute sql at remote database source.
Below is the simple operator code written in Airflow DAG,
t2 = OracleOperator(
task_id='task_2',
oracle_conn_id='ORA_DATABASE_SYSTEM',
sql='/query.sql',
dag=dag)
query.sql is the file created , which i want to have multiple sql statements which can be DDL or DML, but while running DAG it throws
cx_Oracle.DatabaseError: ORA-00922: missing or invalid option
.sql file have following sql statement,
create table SP(name varchar(50), age int);
insert into SP (name,age) values('Suraj',24);
insert into SP values('Ashish',27);
AM i doing something wrong ?
It would be help if anyone can share trying different or pointing right way of doing it.
After some try outs, i am able to use Oracle Operator to execute multiple sql statements on remote Oracle database using .sql script.
# template_searchpath is the path where .sql files are stored
dag = DAG('Test_Oracle_Connection', default_args=default_args,template_searchpath=['/home/Ashish'])
t2 = OracleOperator(
task_id='task_2',
oracle_conn_id='Oracle_connection',
sql='/oracle_query.sql', #SQL file name
dag=dag)
oracle_query.sql file contains multiple sql statements, for example
DECLARE
sql_smt VARCHAR2 (5000);
sql_smt := q'[<SQL_STATEMENT>]'
EXECUTE IMMEDIATE sql_smt;
EXECUTE IMMEDIATE 'commit';
This might not be the best way but at least working for me at the moment.
Please share any other best way if there, to connect to remote Oracle database and execute your queries which can be DDL or DML.
I need to do a mass insert into my database. I have French characters(e.g é) into my table
When i connect to SQLPlus and run the query manually
INSERT INTO TEST VALUES ('é');
Data is inserted properly.
When i save the same query in an Sql file and execute same through SQLplus
I get below error:
SQLPLUS>#test.sql;
ERROR:
ORA-01756: quoted string not properly terminated
Can anyone guide me.
thanks
I need to quickly execute stored procedure which updates table with data from different data source in SQL Server. Is it possible to do it with EF7, I have tried FromSql, but this seems to only works with the mapped entities.
It doesn't need to return anything, just execute.
Is there any other method than using SQLConnection, or SQL job running every 10 minutes on the server?
I think you can use DbContext.Database and ExecuteSqlCommand to execute your stored procedure.
_db.Database.ExecuteSqlCommand("EXEC mySp");
I had a stored procedure with no arguments which was invoked form the UNIX
script by db2 call and the SP was working fine and script running fine as well.
The new requirement is to pass a file name to the stored procedure and do some
business logic -- I am not able to pass the file name from UNIX to the SP. I am using IN parameter of Varchar(50).
The SP compiled fine and is available in the correct schema -- I invoked
using multiple ways and none of them are working fine.
Please help me debug this.
DB2 Stored Procedure:
CREATE PROCEDURE ABC.sp_Update(IN FILE_NAME VARCHAR(50))
Different methods I tried Calling the DB2 stored proc from the UNIX script
db2 call "ABC.sp_Update("filename.txt")"
db2 call "ABC.sp_Update(("filename.txt"))"
FILE_NAME="filename.txt"
db2 call "ABC.sp_Update($FILE_NAME)"
FILE_NAME="filename.txt"
db2 call "ABC.sp_Update($(FILE_NAME))"
The error I get:
db2 call ABC.sp_Update(filename.txt)
SQL0206N "FILENAME.TXT" is not valid in the context where it
is used. SQLSTATE=42703
When I checked for the execution status of the command I get a return code 4
+ RC=4
Before the code change, this worked fine:
db2 call "ABC.sp_Update()"
When I Googled the description of the error 42703, it is An undefined column, attribute, or parameter name was detected.
Sorry Guys - Should have used a single Quote - It worked - Thanks and sorry
I am trying to set up the SQL Adapter in BizTalk 2009 to use a Stored Procedure in our SQL 2008 DB. For some reason, when I click "generate" in the wizard, and then click "next," I receive the following message:
Failed to execute SQL Statement. Please ensure that the supplied syntax is correct. New Transaction cannot enlist in the specified transaction coordinator.
I know the stored proc works, because we call it from C# code as well and I don't have a problem with it. I'm pretty sure I'm missing something basic, but I can't find what it is, and the only information I can find on using Stored Procs through the BizTalk SQL Adapter only show Select statements, so I don't know if there's some other setting I"m missing.
Here's the Stored Proc:
SET NOCOUNT ON;
Declare #Client int
set #Client = (Select Client_Id from Clients where Client_Name = #clientName)
Insert Into [FTP_Data].[dbo].[FileLog](Client_Id, Client_Name, FileType, Received)
Values(#Client, #clientName, #fileType, GETDATE());
Edit/Update: When I move the solution off my developer box and onto the actual server box, it works fine. As far as I can tell, the only difference is that the actual BizTalk Server components (instead of just the developer stuff) are on the same machine as the SQL Server to which I'm connecting. I would think that should be an issue, though...
"New Transaction cannot enlist in the specified transaction coordinator". Seems to indicate a possible DTC error. Is this the SQL server that the BizTalk databases are installed on?