63
Views
4
Comments
[Oracle Connector - P11] Problem calling an Oracle function
oracle-connector-p11
Web icon
Forge asset by Eduardo Oliveira
Application Type
Traditional Web

Hi. 

Hi have this function above that I have to run, but I'm having the error: ORA-06550: linha 1, coluna 7:

PLS-00306: wrong number or types of arguments in call to 'RDS_VALIDA_LEI'


FUNCTION RDS_VALIDA_LEI RETURNS NUMBER

Argument Name                  Type                    In/Out Default?

------------------------------ ----------------------- ------ --------

P_LEI                          VARCHAR2                IN             

P_DATE                         DATE                    IN     DEFAULT 


NUM_ENT                        VARCHAR2(20)            IN     DEFAULT 




I also tried to put the ToObject(Result) on the input OutputList but the error is the same.

Can anyone help me?

Thanks!

2021-08-30 15-28-09
Leandro Correa

Hi Rui,

What is the data type of the attributes in the structure?

Is it the date format the same of the database?


Regards,

Leandro.

UserImage.jpg
Rui Sousa

Hi Leandro.

The detail of the function is this one:

This is the structure that I'm using in OutSystems:

P_LEI - Text

P_DATE - Date

NUM_ENT - Text

How can I check if the date format is the same of the database?

Thanks!

2026-01-05 19-12-05
Jeremy Samkowiak
Staff

Hello Rui.

I had a customer run into something similar recently. The problem ended up being this.

https://support.oracle.com/knowledge/Oracle%20Database%20Products/261084_1.html

I was able to work around it by editing the C# code for the Oracle Connector. Please note that my changes have only been minimally tested and specifically for my customer's use case which was slightly different, but in short, this is the process I followed.

If the callType is "FUN" then I register the return parameter before the in parameter(s). Also, when retrieving the outputs, if the callType is "FUN" I retrieved the first parameter instead of the last parameter since the return parameter was registered first.

Again, this is not well tested and probably isn't the best way to approach this problem but the code ended up like this.

cmd = CreateCommand(connectionName, oracleBD, oracleUser, oraclePass, PKGName, callName, ref cn, ref trans);

                // Input parameters

                int NrOfParameters = 0;

                if (callType == "SP")

                {                    

                    NrOfParameters = AddInputParameters(parameters, cmd, callName);

                }

                // Add Simple Outputs

                int NrOfSimpleOutputs = AddSimpleOutputs(callType, simpleOutputs, simpleOutputTextSize, cmd, callName, ref SimpleOutputRec, ref SORecBaseStruct, ref SORecValueStruct, ref SORecFields);

                // Add Cursor Output

                if (outputList != null)

                {

                    if (!String.IsNullOrEmpty(cursorName))

                        ClOracle.addOutputParameter(cmd, cursorName, OracleDbType.RefCursor);

                    else

                        ClOracle.addOutputParameter(cmd, "a_cursor", OracleDbType.RefCursor);

                }

                if (callType == "FUN")

                {                    

                    NrOfParameters = AddInputParameters(parameters, cmd, callName);

                }

                // Execute Command

                if (cn != null) { cn.Open(); }


                // According to the specified output, perform a different execution method 

                if (outputList != null)

                {

                    dReader = cmd.ExecuteReader();

                }

                else

                {

                    cmd.ExecuteNonQuery();

                }

                // Retrieve Simple Outputs

                if (callType == "FUN")

                {

                    RetrieveOutputs(simpleOutputs, 0, cmd, SimpleOutputRec, SORecBaseStruct, SORecValueStruct, SORecFields);

                }

                else

                {

                    RetrieveOutputs(simpleOutputs, NrOfParameters, cmd, SimpleOutputRec, SORecBaseStruct, SORecValueStruct, SORecFields);

                }

2022-03-12 12-24-38
Carlos Falcao

Hello Rui.

You should use the ExecuteFunction for functions instead of ExecuteSP (this one is used for StoredProcedure).

Regards.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.