Convert blob image to PUBLIC.ORDIMAGE in plsql - oracle

When I try to convert a blob image to PUBLIC.ORDIMAGE in plsql I get error
ORA-06512 ORDSYS.ORDIMAGE
insert into image(image) values (ORDSYS.ORDImage(blob_image));
I'm also trying to use a function to resize blob but get below error:
create or replace FUNCTION resize_img (p_ID varchar)
RETURN BLOB
IS
vImageData BLOB;
vSizedImage BLOB;
BEGIN
select blob_img into vImageData from my_table where ID = p_ID;
DBMS_Lob.createTemporary(vSizedImage, FALSE, DBMS_LOB.CALL);
ORDSYS.OrdImage.processCopy(vImageData, 'maxScale=75 75', vSizedImage);
return vSizedImage;
END resize_img;
When I call function I get error:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "ORDSYS.ORDIMAGE", line 456
ORA-06512: at "MYSCHEMA.RESIZE_IMG", line 14
06510. 00000 - "PL/SQL: unhandled user-defined exception"
*Cause: A user-defined exception was raised by PL/SQL code, but not handled.
*Action: Fix the problem causing the exception or write an exception handler for this condition. Or you may need to contact your application administrator or DBA.
Any solution?

OrdImage is part of Oracle Multimedia, which was deprecated in 18c and removed in 19c.
As an alternative for image processing and conversion, Oracle recommends that you store multimedia content in SecureFiles LOBs, and use third party products, such as Piction. The ORDIM component remains in the registry and still has a VALID status. Oracle Multimedia objects and packages remain in the database. However, these objects and packages no longer function, and raise exceptions if there is an attempt made to use them. Oracle Locator is not affected by the desupport of Oracle Multimedia.

Related

IBM ACE - Calling Oracle Procedure returning a rowtype (via ESQL compute node)

I'm trying to call procedure stored in plsql. Here is what I've tried so far.
In Oracle:
create or replace PROCEDURE dbSwapParms
( in_param IN VARCHAR2,
out_param OUT varchar2,
inout_param IN OUT customer%ROWTYPE)
AS
BEGIN
select *
into inout_param
from SYS_ENDPOINTS where customer_name=in_param; -- assuming this query returns single row
END;
In Compute node:
-- Definition of procedure
CREATE PROCEDURE swapParms (
IN parm1 CHARACTER,
OUT parm2 CHARACTER
)
LANGUAGE DATABASE
DYNAMIC RESULT SETS 1
EXTERNAL NAME dbSwapParms;
-- Invoking the procedures
CALL swapParms( inputParm, outputParm, OutputRoot.JSON.Data.test[]); -- found this in ibm documentation returning result set
Here is the error:
BIP2230E: Error detected whilst processing a message in node 'gen.CB_testBar.postHelloWorld (Implementation).Compute4'.
BIP2488E: ('.postHelloWorld_Compute4.Main', '19.4') Error detected whilst executing the SQL statement ''CALL swapParms(inputParm, outputParm, OutputRoot.JSON.Data.test[]);''.
BIP2934E: Error detected whilst executing the function or procedure ''swapParms''.
BIP2321E: Database error: ODBC return code '-1' using ODBC driver manager ''odbc32.dll''.
BIP2322E: Database error: SQL State ''HY000''; Native Error Code '0'; Error Text ''[IBM][ODBC Oracle Wire Protocol driver]SQL type not supported: 0''.
I'm not sure if I've represented the oracle procedure correctly.
I made it work by using plsql function instead of procedure. The function returns ref cursor as a result set. Then, applied the ibm documentation of invoking procedure returning resultset.

Call Oracle stored procedure from PowerBI

I am using PowerBI (64b) with an Oracle 11g database.
When I try to connect to Oracle by stored procedure, I get an error, I don't know if I'm doing it right. please appreciate any help.
Observation: if there is a connection to the database, I can list the tables, etc.
I'm not calling the stored procedure correctly, what should I change? Thanks a lot,
procedure SPU_LISTAR_1(
FINI IN DATE,
FFIN IN DATE,
RS_CURSOR_LISTA IN OUT TYP_CURSOR)
AS
BEGIN
OPEN RS_CURSOR_LISTA FOR
SELECT IDPROCESO,CAMPO1
FROM TABLA1
WHERE FECHA BETWEEN FINI AND FFIN ;
END;
This is how I call this stored procedure from PowerBI:
DECLARE RS_CURSOR_LISTA SYS_REFCURSOR;
BEGIN
[STOREDPROCNAME]('01/01/2019','05/01/2019');
DBMS_SQL.RETURN_RESULT(RS_CURSOR_LISTA);
END;
And this is the error I get:
An error was encountered while trying to connect.
Details: "Oracle ORA-06550: line3, column1":
PLS-00201: Identifier 'SPU_LISTAR_1' must be declared
ORA-06550: PL / SQL: Statement ignored
pls-00302: Component 'RETURN_RESULT' must be declared
ORA-06550: PL / SQL: Statement Ignored

How to call Oracle stored procedure from azure data factory v2

My requirement is copy data from Oracle to SQL Server. Before copying from Oracle database, I need to update the Oracle table using procedure which has some logic.
How do I execute Oracle stored procedure from Azure datafactory?
I referred to this thread
if I use EXECUTE PROC_NAME (PARAM); in preCopy script it's failing with following error
Failure happened on 'Source' side.
ErrorCode=UserErrorOdbcOperationFailed,
Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException
Message=ERROR [42000] [Microsoft][ODBC Oracle Wire Protocol driver]
[Oracle]ORA-00900: invalid SQL statement
Source=Microsoft.DataTransfer.ClientLibrary.Odbc.OdbcConnector,
Type=System.Data.Odbc.OdbcException
Message=ERROR [42000] [Microsoft][ODBC Oracle Wire Protocol driver]
[Oracle]ORA-00900: invalid SQL statement,Source=msora28.dll
Could anyone help on this?
Note: I am using self-hosted runtime environment for data factory
thanks!!
I used a Lookup Activity and a SELECT statement of DUAL TABLE. Due to the stored procedures can not be call from a statement SELECT. I created an oracle function and the function calls the stored procedure. The function returns a value and this value is received by the lookup activity.
When you define the function, you have to add the statement PRAGMA AUTONOMOUS_TRANSACTION. This is because Oracle does not allow to execute DML instructions with a SELECT statement by default. Then, you need to define that DML instructions in the Stored Procedure will be an autonomous transaction.
--Tabla
CREATE TABLE empleados(
emp_id NUMBER(9),
nombre VARCHAR2(100),
CONSTRAINT empleados_pk PRIMARY KEY(emp_id),
);
create or replace procedure insert_empleado (numero in NUMBER, nombre in VARCHAR2) is
begin
INSERT INTO empleados (emp_id, nombre)
Values(numero, nombre);
COMMIT;
end;
create or replace function funcinsert_empleado (numero in NUMBER, nombre in VARCHAR2)
return VARCHAR2
is
PRAGMA AUTONOMOUS_TRANSACTION;
begin
insert_empleado (numero, nombre);
return 'done';
end;
--statement in query of lookup
SELECT funcinsert_empleado ('1', 'Roger Federer')
FROM DUAL;
Example lookup
This is example in Spanish. https://dev.to/maritzag/ejecutar-un-stored-procedure-de-oracle-desde-data-factory-2jcp
In Oracle, EXECUTE X(Y) is a SQL*Plus-specific command shortcut for the PL/SQL statement BEGIN X(Y); END;. Since you are not using SQL*Plus, try the BEGIN/END syntax.
In case you only want to execute the DML query using the Azure Data Factory without procedure on oracle database :-
I have another solution where you can use the copy activity with the pre-copy feature of sink in-spite of lookup activity.
For this approach just follow the below steps :-
Keep both the source table and sink table as same ( Let say table A ) using the same linked service.
In sink use the pre-copy script feature and keep the DML (Insert/Update/Delete ) query that you want to perform over the table B.( This table is not necessary to be same as table A )
In case you want to avoid the copy of data to same table you can select query option in the source part and provide a where clause which is not going to satisfy and hence no copy of data will happen .
or you can create a table temp with one column and one row .
I have tested both the options and it works ... good part of above solution is you can avoid the procedure or function creation and maintenance .

error when collecting tokens from a full text database

I want to test Oracle's CTX_DOC.TOKENS procedure in order to count the number of occurrence of a string into a document.
For this, I have:
create table documents (id number primary key, text bfile);
insert into documents values (1, bfilename('MY_DIR','12things_about_122.pdf'));
create index documents_idx on documents (text) indextype is ctxsys.context;
declare
the_tokens ctx_doc.token_tab;
begin
ctx_doc.set_key_type ('PRIMARY_KEY');
ctx_doc.tokens('documents_idx','1',the_tokens);
dbms_output.put_line('Number of tokens: '|| the_tokens.count);
end;
When I test this, the PLSQL part fails with:
Error report:
ORA-20000: Oracle Text error:
DRG-10001: can not access result table the_tokens
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.CTX_DOC", line 862 ORA-06512: at line 5
00000 - "%s"
*Cause: The stored procedure 'raise_application_error'
was called which causes this error to be generated.
*Action: Correct the problem as described in the error message or contact
the application administrator or DBA for more information.
Can you help me to understand what is needed much more in order to work correctly, please?
Thank you,
it seems that the answer was too easy to be seen from the 1st time:
It was necessary to referenciate the ctx_doc.token_tab; with schema name, too.
Instead of the_tokens ctx_doc.token_tab, I had to do the_tokens ctxsys.ctx_doc.token_tab;

How to deploy Oracle Dimension table for OLAP Cubes

I followed First Example as well as Second Example to create Cubes in Oracle 10g.
I tried to create cube using query rewrite mechanism in Oracle 10g.
(Intailly tried to create using Analystic workspace manager we got error in that too so only we went for query rewrite mechansism)
We succeded in creating table "PRODUCTS"
Also we succedded in creating Dimension for that table "PRODUCTS"
But when we try to create Attribute for the above "PRODUCTS" table like below
BEGIN
cwm_classify.remove_entity_descriptor_use(28, cwm_utility.DIMENSION_TYPE, 'SH', 'PRODUCTS');
COMMIT;
END
we are getting following error.
Note : We have data inside table too
Error starting at line 1 in command:
begin
cwm_classify.remove_entity_descriptor_use(28, cwm_utility.DIMENSION_TYPE, 'SH', 'PRODUCTS');
commit;
end;
Error report:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "OLAPSYS.CWM$OLAP$DIMENSION", line 242
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "OLAPSYS.CWM$UTIL", line 368
ORA-01403: no data found
ORA-06512: at "OLAPSYS.CWM$CLASSIFY", line 322
ORA-06512: at "OLAPSYS.CWM$CLASSIFY", line 1198
ORA-06512: at line 2
06510. 00000 - "PL/SQL: unhandled user-defined exception"
*Cause: A user-defined exception was raised by PL/SQL code, but
not handled.
*Action: Fix the problem causing the exception or write an exception
handler for this condition. Or you may need to contact your
application administrator or DBA.
When i googled i got suggestion like we have to deploy Dimension also before deploying Cubes.
So i'm trying to create OLAP Cubes for this i need to to deploy Dimension Tables in Oracle.
Is there any way to deploy Dimension is that possible actually?
Suggest me how to do this?
Assuming you are using Analytic Workspace Manager, the OLAP documentation would be a good place to start:
http://download.oracle.com/docs/cd/E11882_01/olap.112/e17123/cubes.htm#BGBDJAAG

Resources