When I run the script below by itself it works just fine:
set uuid = (select UUID_STRING());
select $uuid;
But when I run it inside a stored procedure it errors:
JavaScript compilation error:
Uncaught SyntaxError: Unexpected identifier in sp_personinsert at '
set uuid = (select UUID_STRING());' position 8
Related
I have version 8 of MySQL but need to update a database stored procedure that is using 5. When I test this code in version 8 I do not receive any errors. However when I add it to the stored procedure on the the older version I receive the following error:
ERROR 1064: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near 'DIAGNOSTICS CONDITION 1 errstate = RETURNED_SQLSTATE, msg =
MESSAGE_TEXT;
This is the code that I have inserted that is causing the error.
DECLARE errstate CHAR(5) DEFAULT '00000';
DECLARE msg TEXT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1
errstate = RETURNED_SQLSTATE,
msg = MESSAGE_TEXT;
END;
I could not find any documentation specific to version 5 for using GET DIAGNOSTICS CONDITION.
In the SAP Documentation is an EXPORT statement described.
Unfortunately I have the following error in a stored procedure:
Syntax error in procedure object: incorrect syntax near '#': line 18 col 8 (at pos 487)
Line 18 is:
EXPORT #MY_EXPORT AS CSV INTO '/path/filename' with replace;
How to fix this?
Full SQL
PROCEDURE "MY_SCHEMA"."my.package::EXPORTCVINTOCSV" ( )
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
DEFAULT SCHEMA MY_SCHEMA
AS
BEGIN
--create local temporary table #MY_EXPORT as (
create table MY_EXPORT as (
SELECT a.*
FROM "_SYS_BIC"."my.package/myView" a
JOIN "_SYS_BIC"."my.package/myOtherView" b
ON a."CheckID" = b."CheckID"
WHERE a."SchedulingID" IS NOT NULL
);
EXPORT MY_EXPORT AS CSV INTO '/my/export/path' with replace;
END;
for unknown reasons IMPORT & EXPORT are not supported as procedure body, but as workaround you can wrap them into exec, .e.g.
EXEC 'EXPORT MY_EXPORT AS CSV INTO ''/my/export/path'' with replace';
the error message is confusing, but export of local temporary tables is anyway not supported.
If you try such statement outside the procedure you get:
SQL Error [7] [HY000]: SAP DBTech JDBC: [7]: feature not supported: cannot export local temporary table #MY_EXPORT
1) Downloaded the impala drivers 2.5.37 from
https://www.cloudera.com/downloads/connectors/impala/jdbc/2-5-37.html
2) Executed:
call apoc.load.driver("com.cloudera.impala.jdbc4.Driver")
No errors.
3) Executed:
CALL apoc.load.jdbc("jdbc:impala://<URL>:21050/default;user=<username>;password=<password>",
'<database>.<table name>') YIELD row
RETURN row.account as account_num
Error :Failed to invoke procedure apoc.load.jdbc: Caused by:
java.lang.RuntimeException: Cannot execute SQL statement `SELECT *
FROM .. Error: [Simba]ImpalaJDBCDriver
Error setting/closing session: {0}.
Can you please help me out?
The second argument to apoc.load.jdbc must be a string that is either a table name or a SQL statement. Replace '.' with the appropriate value (in your case, probably the name of the table that contains the account column).
I am trying to upgrade an SSIS package from 2008 to 2012 and getting the below error.
Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has
occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native
Client 11.0" Hresult: 0x80004005 Description: "The metadata could
not be determined because statement 'EXEC master.dbo.xp_logevent
#ErrorCode, #Message, error' in procedure 'DebugPrint' invokes an
extended stored procedure.".
Error: Unable to retrieve destination column descriptions from the
parameters of the SQL command.
Basically, we have an OLE DB Command to call a stored procedure which call several (nested) stored procedures and one of it is DebugPrint which call master.dbo.xp_logevent. Any idea to fix it? It works in SSIS 2008.
Thanks
You could try using 'with result sets' when calling your proc and setting your metadata there.
Example :
EXEC dbo.proc
WITH RESULT SETS (
ID INT
,Col2 VARCHAR)
I came across a similar error.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "The metadata could not be determined because statement '....' uses a temp table.".
Work around.
If SP uses a #table or ##table and it is used in the SP, then we need to specify the #table structure along with the EXEC.
The SP should be given along with the structure.
EXEC SP_TestTemp 1,2
it should be given like
EXEC SP_TestTemp 1,2 WITH RESULT SETS
(
(
id int,
Marks int
)
)
Note: the 'retain same connection = true' and 'validate external metadata' = false did not help/work here
I have used Inserts, selects, updates, deleted without problem all over the program but for some reason this specific section causes it to except and not run the SQL I send it.
I am trying to "UPDATE SectionTable(AreaID) VALUES ('+IntToStr(ActClient.AreaID)+') WHERE SectionID='+IntToStr(iCount)"
The section with the ID "iCount" exists deffinately. The ActClient.AreaID is "2" and its overwriting null data in the "SectionTable" table.
What is the problem here?
OpenDatabase(slDb);
sltb:=sldb.GetTable('SELECT * FROM SectionTable WHERE SectionID='+IntToStr(iCount));
OutputDebugString(PAnsiChar(sltb.FieldAsString(sltb.FieldIndex['SectionID'])+sltb.FieldAsString(sltb.FieldIndex['Gender'])+sltb.FieldAsString(sltb.FieldIndex['CompetitionID'])));
sSQL := 'UPDATE SectionTable(AreaID) VALUES ('+IntToStr(ActClient.AreaID)+') WHERE SectionID='+IntToStr(iCount);
sldb.ExecSQL(sSQL);
CloseDatabase(slDb);
I get this error message appear when this is ran.
---------------------------
Debugger Exception Notification
---------------------------
Project CompetitionServer.exe raised exception class ESQLiteException with message 'Error executing SQL.
Error [1]: SQL error or missing database.
"UPDATE SectionTable(AreaID) VALUES (2) WHERE SectionID=2": near "(": syntax error'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
UPDATE table SET column = expression, column = expression WHERE predicates