I would like to write an AUTONOMOUS stored procedure (native). I'm using the DB2 database (V11.01)
CREATE PROCEDURE SP_LOG (IN p_field1 char(2)
,IN p_field2 varchar(50)
,IN p_field3 varchar(50)
,IN p_field4 varchar(3926) )
VERSION V1
ISOLATION LEVEL CS
WLM ENVIRONMENT FOR DEBUG MODE WLMENV1
RESULT SETS 0
LANGUAGE SQL
ALLOW DEBUG MODE
AUTONOMOUS
BEGIN
...
...
END
I'm using IBM DATA STUDIO 4.1.1 and I get the following error:
Creazione di procedura memorizzata restituzioni
SQLCODE: -104, SQLSTATE: 42601. XXXXX.SP_LOG: 11: ILLEGAL SYMBOL
"". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: FOR.
SQLCODE=-104, SQLSTATE=42601, DRIVER=4.18.60 XXXXX.SP_LOG -
Distribuzione per il debug non riuscita. XXXXX.SP_LOG - Rollback
completato correttamente.
If you have any recommendations, I'd love to hear them!
Thanks :)
Good news, I found the issue.
This is a bug of IBM Data Studio (IT26018 - AUTONOMOUS KEYWORD IS NOT CONSIDERED AS A VALID KEYWORD FOR DB2 ZOSV11 AND V12 IN DS.4.1.3 - For more information click here.
Here's how I solved it:
I downloaded the new version (IBM DATA STUDIO 4.1.3) - Link
Installed the new version using IBM INSTALLATION MANAGER
I downloaded the FIX - Link
Installed the FIX (Instructions are included in the .ZIP file (open the "Hotfix Guide.pdf" file)
Related
I have a large insert query with ends in an error:
Msg 8152, Level 16, State 4, Line 1
String or binary data would be truncated
After some research I tried using TRACE FLAG 460, using the command below:
INSERT...
VALUES...
OPTION (QUERYTRACEON 460);
This gave the same error as before, so I tried to turn on the flag on server-level, using the command below:
DBCC TRACEON(460, -1);
Again, no change in the output. But when I check the flagstatus it gives all the right information:
DBCC TRACESTATUS(460);
TraceFlag Status Global Session
460 1 1 0
Does anyone have a clue how I can get Trace Flag 460 working? My server information is down below:
Edition: Developer Edition (64-bit)
ProductVersion: 14.0.2037.2
ResourceLastUpdateDateTime: 2020-11-02 21:20:26.783
ResourceVersion: 14.00.2037
BuildClrVersion: v4.0.30319
Have you checked the documentation??
It clearly says:
Note: This trace flag applies to SQL Server 2017 (14.x) CU12 and higher builds
Which means SQL Server 2017 has to have a build version number of 14.0.3045.24 or higher - which you don't seem to have.
So you'll need to install at least CU12 (or better yet: the latest CU22 - https://www.microsoft.com/en-us/download/details.aspx?id=56128) on your machine for this to work
See: SQL Server 2017 build versions - for all the details about the official version numbers of SQL Server 2017 (and it's various CU's)
I'm writing a stored procedure (on AIX environment) and I need to activate "DYNAMICRULES BIND" selected.
CREATE OR REPLACE PROCEDURE jjjjjj_PROVA
( IN p_input1 CHAR(2) )
LANGUAGE SQL
SPECIFIC jjjjjj_PROVA
DYNAMICRULES BIND
P1: BEGIN
...
...
END P1
In the distribution phase I get the following error.
xxxxx.jjjjjj_PROVA - Distribuzione avviata.
Creazione di procedura memorizzata restituzioni SQLCODE: -104, SQLSTATE: 42601.
xxxxx.jjjjjj_PROVA: 12: An unexpected token "BIND
P1" was found following "DYNAMICRULES". Expected tokens may include: "<space>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.19.56
An unexpected token "BIND
P1" was found following "DYNAMICRULES". Expected tokens may include: "<space>".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.19.56
xxxxx.jjjjjj_PROVA - Distribuzione non riuscita.
xxxxx.jjjjjj_PROVA - Rollback completato correttamente.
The same statement in the DB2 Z / OS environment is correct.
Tips?
Thank you!!
Use CALL SET_ROUTINE_OPTS('DYNAMICRULES BIND') statement before CREATE PROCEDURE in the same session.
Customizing precompile and bind options for compiled SQL objects
I tried to create an Oracle PL/SQL package in Db2, but ran into errors.
CREATE OR REPLACE PACKAGE ARITHMETIC AS
function add (
first number,
second number)
return number;
END ARITHMETIC;
CREATE OR REPLACE PACKAGE BODY ARITHMETIC AS
function add(
first number,
second number)
return number AS
BEGIN
return first + second;
END add;
END ARITHMETIC;
When I run the above code, it results in the following error:
Deploy [tnbdr]DB2INST1.ARITHMETIC Running
DB2INST1.ARITHMETIC - Deploy for debug started.
Create PL/SQL Package Specification returns SQLCODE: -104, SQLSTATE: 42601.
DB2INST1.ARITHMETIC: 1: An unexpected token "PACKAGE" was found
following "CREATE OR REPLACE ". Expected tokens may include:
"VIEW".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.18.60
An unexpected token "PACKAGE" was found following "CREATE OR REPLACE ". Expected tokens may include: "VIEW".. SQLCODE=-104,
SQLSTATE=42601, DRIVER=4.18.60
DB2INST1.ARITHMETIC - Deploy for debug failed.
DB2INST1.ARITHMETIC - Roll back completed successfully.
How can I deploy the package, why is it failing?
Db2 supports the compilation / creation of PL/SQL packages when the database is set up for Oracle compatibility:
db2set DB2_COMPATIBILITY_VECTOR=ORA
db2stop
db2start
Bit 12 in the DB2_COMPATIBILITY_VECTOR enables PL/SQL compilation.
I'am using Oracle Apex and I have a form to upload and store a file in a table via wwv_flow_files
In order to download the file I am using the procedure download_my_file
When I try to click the link and download the error 404 is raised
My environment is
Application Express 4.2.6.00.03
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
Oracle Rest Data Service 3.0.9.348.07.16
Thanks to any suggestion or advice
EDIT:
I check the stored procedure in Apex going Home->SQL Workshop->SQL Commands
If I copy and paste the code and instead of the parameter I use a known ID the execution is successful.
With the syntax download_my_file?p_file=#ID# url is
http://myhost:8080/ords/download_my_file?p_file=24255
the error 404 Not found is raised.
With the syntax #OWNER#.download_my_file?p_file=#ID# url is
http://myhost:8080/ords/mypdb.download_my_file?p_file=24255
the error 403 Forbidden is raised.
EDIT 2 : as requested here is the procedure
PROCEDURE download_my_file(p_file in number) AS
v_mime VARCHAR2(48);
v_length NUMBER;
v_file_name VARCHAR2(2000);
Lob_loc BLOB;
BEGIN
SELECT files_mime_type, files_content, files_name, dbms_lob.getlength(files_content)
INTO v_mime,lob_loc,v_file_name,v_length
FROM pub_db0files
WHERE files_id = p_file;
--
-- set up HTTP header
--
-- use an NVL around the mime type and
-- if it is a null set it to application/octect
-- application/octect may launch a download window from windows
owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
-- set the size so the browser knows how much to download
htp.p('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a save as
htp.p('Content-Disposition: attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( Lob_loc );
end download_my_file;
According to documentation «Fusion Middleware User's Guide for mod_plsql» regarding to wpg_docload.download_file we have to «add the line WindowsFileConversion Off to DAD entry.
Open the file ORACLE_INSTANCE\config\OHS\ohs1\mod_plsql\dads.conf.
Locate the DAD used to access the application.
Add the line WindowsFileConversion Off to this DAD entry.
Save the file.
Restart Oracle HTTP Server.
If you do not update the DAD configuration, you will experience failures while downloading documents which contain 0x5c in the filename. For example:
In Oracle Portal, you will see the download error:
Error: Document not found (WWC-46000)
When using mod_plsql against your own PL/SQL application, file downloads will result in the error:
HTTP-404 Not Found
https://docs.oracle.com/cd/E28280_01/portal.1111/e12041/concept.htm#YPMOD001
I am using ssis of sql 2008 trying to connect to sybase 12 using sybase 15.2 driver, i even tried sybase 12 driver and got same error
error message
[ZZZZZ]
[Message Class: 16]
[Message State: 5]
[Transaction State: 1]
[Server Name: PHXPROD]
[Native Code: 2812]
[ASEOLEDB]Stored procedure 'sp_oledb_datatype_info' not found.
Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output). (ASEOLEDB)
attached images showing that i am able to connect but soon after connecting i get the error message
Step 1
Step 2
Error message when i used ADO.NET
Look like you have to investigate more about this problem and by reading in the SyBooks Online it say:
If error 2812 occurs on system stored procedures (as your case sp_oledb_tables and sp_oledb_datatype_info) it may be resolved by running the installmaster script, which installs all system procedures and initializes various other Adaptive Server structures.
How to run the installmaster script?
Using isql, run the new installmaster script included with this release by entering:
isql -Usa -P<sa password> -S<server name> -n -i$SYBASE/$SYBASE_ASE/scripts/installmaster
-o<output file>
Reference: Running the installmaster script
Hope it help you