I wanted to fetch the currently executing queries in Teradata and when I ran the below SQL and I got the error message as 'Failed 9881 : Function 'MonitorSQLText' called with an invalid number or type of parameters'. I am using TD 14.10
SELECT * FROM TABLE (MonitorSQLText(-1, '*', 0)) AS T2;
Please help me with this query.
MonitorSQLText can only be applied to a single session.
To get info for all sessions you must use MonitorSession(-1, '*', 0), when you do it in a Stored Procedure you can run it as a cursor and process each row.
Related
I'm running a dag with an insert query. Here is some of the code:
QUERY = '''
INSERT INTO bi.target_skus (skus)
SELECT
distinct od.sku,
FROM
bi.orders as od'''
t1 = MySqlOperator(
sql=QUERY,
mysql_conn_id = MYSQL_CONN_ID,
task_id='target_skus',
dag=dag)
It's giving me the following error:
ERROR - (1142, "INSERT command denied to user 'xyz' for table 'target_skus'")
A few notes:
Devops said my user has permission to make inserts into that table
Select commands work fine
The error message does not include the database name (bi) even though my insert query does.
This looks like a standard MySQL "not enough privileges" error.
Are you sure you can perform INSERTs with your user, regardless of what your DBA is saying? You should test the same operation using another tool (like MySQL Workbench) setting up the connection in the same way you set it up in Airflow, i.e. same user, same password, same default schema.
It looks like a privilege error from the user trying to insert but there is a comma in the insert that can cause problems too:
QUERY = '''
INSERT INTO bi.target_skus (skus)
SELECT
distinct od.sku
FROM
bi.orders as od'''
i want to create in mysql an event schedule every day that check
if the current date is greater than a date stored in the database table and then call some store procedures.
Reading my WRONG mysql code you will understand that i want to do:
delimiter $
set global event_scheduler = on$
create event if not exists `end_qualifications`
on schedule
every day
do
begin
if curdate() >= (select `end_date` from `round` where `nome` =
"qualifications")
then
/* call myprocedure(params); */
end if;
end $
delimiter ;
I found here If-statement in the MySQL stored procedure for selecting data something similar, but there is not way my code work as i want.
I'm a beginner with mysql so it's possible that what i want to do can't be done.
Anyone knows how to make my code work?
I'm using MySQL client version: 5.7.25
EDITED: this is the error i get when i try to run the query
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MariaDB server version for the right
syntax to use near 'do
begin
if curdate() >= (select `end_date` from `round` where `nome` =
"q' at line 5
I don't know if it matters, but the database is empty for now.
Is it possible to create and/or use temporary tables in the ODBC connector stage of the DataStage?
I'm trying to update the data using a #Temp table in the join statement immediately after populating the Temp table.
I had looked according to the error form the job's log file but couldn't understand what it says,
Error message:
Unrecognized argument: variant='3.5\',
library=ccodbc,
version=1.0,
variantlist=\'V1;3.5::ccodbc\',
versionlist=\'1.0\',
name=ODBCConnector
}'
SAX parser exception thrown: The input ended before all started tags were ended. Last tag started was 'before' (CC_PropertySet::fatalError, file CC_PropertySet.cpp, line 2,266)
Got a solution!
Yes, we can use #Temp tables of SQL Server in DataStage ODBC stage, the query was absolutely perfect but the thing is DataStage couldn't prase the SQL Query. It considered it as DataStage parameter (since parameters in DataStage were bounded with #ParameterName#) So the DataStage compiler consider it as a incomplete parameter and thrown the error as above.
Solution: Use [ #Temp_Table ] to solve the issue.
Following Trigger created in a user anu
create or replace trigger audit_creation1
before create
on schema
begin
insert into audit_creation
values(audit_creation_s1.nextval,
ora_dict_obj_owner,
ora_dict_obj_name,
sysdate);
end;
create table cc(cid number);
ORA-00604: error occurred at recursive SQL level 1
ORA-30511: invalid DDL operation in system triggers
This worked before many times. It was working successfully.
But now it's throwing error.
Throw a command
purge recyclebin;
as your trigger owner (anu in your case).
I am creating this oracle 11g statement inside a java String and then executing it in sql developer. I tried running it on the database and got a warning when the trigger
is created. But, when run from the code, I get the error mentioned in my title.
Please tell me where is the mistake and how i can fix it ?
CREATE OR REPLACE TRIGGER myschema.my_sequence_id BEFORE INSERT ON myschema.mytable
FOR EACH ROW BEGIN SELECT my_sequence_id.nextval INTO :new.mycolumn FROM DUAL; end; /
Thanks in advance !
You can't have a trigger named my_sequence_id if you already have a sequence my_sequence_id. They share the same namespace. Your trigger would need to be named something other than the name of the sequence (or any other object in the schema).