• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Oracle Function call
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Oracle Function call


  • Subject: Re: Oracle Function call
  • From: Logi Helguson <email@hidden>
  • Date: Thu, 22 Jan 2009 10:55:23 +0000
  • Thread-topic: Oracle Function call

Title: Re: Oracle Function call
I havn’t called Oracle DB from my model but I’ve done it with java.sql.CallableStatement by passing in all the parameters( including object to get the output parameters ).

Something like this should get you on track:

/* Dummy code for Oracle function call starting */
Connection conn = DriverManager.getConnection( url, username, password ); conn.setAutoCommit( true );

// the name of your function and parameters with the out parameter of the function at the start
String procedure = “{?=call STRING_VALUE_FOR_INT( ? ) }”;
CallableStatement c = conn.prepareCall( procedure );

// returning value from the function call
String resultString = null;
c.setString( 1, resultString );
c.registerOutParameter( 1, java.sql.Types.VARCHAR );

// the parameter
c.setInt( 1, 2008 );

c.executeQuery();

ResultString = c.getString( 1 ); c.close();
/* Dummy code for Oracle function call ending */



Þann 1/21/09 8:51 PM, skrfaði "Tom Pelaia" <email@hidden> eftirfarandi:

Hi,

I am trying to call a function with a return value defined in an Oracle database. I found legacy EOF notes indicating that it was possible to do so by adding an argument named "returnValue" to the EO stored procedure, but this results in the following exception:
    [exec] PLS-00306: wrong number or types of arguments in call to 'LOGBOOK_ENTRY_WORK_ORDER_ASSOC'

Has anyone been able to call function on an Oracle database? If so, how?

I've defined my stored procedure in the model as:
{
    arguments = (
        {
            allowsNull = Y;
            columnName = "p_log_entry_id";
            externalType = NUMBER;
            name = "entryID";
            parameterDirection = 1;
            valueClassName = NSNumber;
            valueType = i;
        },
        {
            allowsNull = Y;
            columnName = "p_work_order_number";
            externalType = NUMBER;
            name = "workOrderID";
            parameterDirection = 1;
            valueClassName = NSNumber;
valueType = i;
        },
        {
            name = "returnValue";
    parameterDirection = 2;
            externalType = NUMBER;
            parameterDirection = 2;
            valueClassName = NSNumber;
    valueType = i;
        }
    );
    externalName = "logbook.logbook_pkg.logbook_entry_work_order_assoc";
    name = linkToWorkOrder;
}


best regards,
tom


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


Með vegsemd og virðingu,
Logi Helgu
Fyrirvari á tölvupósti / e-mail disclaimer
http://us.is/Apps/WebObjects/US.woa/wa/dp?id=3776

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Oracle Function call (From: Tom Pelaia <email@hidden>)

  • Prev by Date: Re: [OT] ActiveRecord.js
  • Next by Date: Re: W3C validation and ERXBatchNavigationBar
  • Previous by thread: Oracle Function call
  • Next by thread: Behaviour of objectsWithFetchSpecification()
  • Index(es):
    • Date
    • Thread