Problems with Oracle Stored Function (Procedure)

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Problems with Oracle Stored Function (Procedure)

    I am trying to call a function in an Oracle database package using
    cfstoredporc. I keep getting the following error:

    [Macromedia][Oracle JDBC Driver][Oracle]ORA-06502: PL/SQL: numeric or value
    error: character to number conversion error ORA-06512: at line 1

    When I turn on robust debugging, it tells me the error occurred in the
    following line:

    <cfprocparam type="in" cfsqltype="cf_sql_varchar" variable="viewschdocs_in"
    value="N" null="no">

    As far as I can tell, everything is correct. Can anyone help me understand
    what might be going on here?

    Thx,
    --Rob

    Rob@PSA Guest

  2. Similar Questions and Discussions

    1. oracle stored procedure calling
      I have two procedures test1 and test2. Resultset is returned by test2. My coldfusion code calls test1. PROCEDURE test1 (in_eid IN NUMBER,...
    2. Oracle Stored procedure error from CF
      I have a stored proc working on a oracle server, connected through JDBC to the CF server. I ran the stored proc on the oracle server through PL/SQL...
    3. oracle mx stored procedure
      "Error Executing Database Query. Incorrect parameter bindings for stored procedure call. Check your bindings against the stored procedure's...
    4. stored procedure from oracle to pgsql
      Dear, I'm new in pgsql, come from oracle and sql server. any one can help by transferring a pl/sql procedure that imports data from a flat file,...
    5. oracle, asp, stored procedure
      I am trying to run a stored procedure from an asp page on an oracle 9i db. The stored procedure will take one parameter and should return two...
  3. #2

    Default Re: Problems with Oracle Stored Function (Procedure)

    check the datatype expected in the ORACLE PL/SQL Statement and make
    sure your passing the appropriate datatype from cfstoredporc (This is
    an error occuring at the db level-hence the ORA-06502 error code).

    javabuzz Guest

  4. #3

    Default Verbose


    javabuzz wrote:
    > check the datatype expected in the ORACLE PL/SQL Statement and make
    > sure your passing the appropriate datatype from cfstoredporc (This is
    > an error occuring at the db level-hence the ORA-06502 error code).
    Verbose-VALUE_ERROR

    An arithmetic, conversion, truncation, or size-constraint error occurs.
    For example, when your program selects a column value into a character
    variable, if the value is longer than the declared length of the
    variable, PL/SQL aborts the assignment and raises VALUE_ERROR. In
    procedural statements, VALUE_ERROR is raised if the conversion of a
    character string into a number fails. (In SQL statements,
    INVALID_NUMBER is raised.)

    javabuzz Guest

  5. #4

    Default Verbose

    javabuzz wrote:
    > check the datatype expected in the ORACLE PL/SQL Statement and make
    > sure your passing the appropriate datatype from cfstoredporc (This is
    > an error occuring at the db level-hence the ORA-06502 error code).
    Verbose-VALUE_ERROR

    An arithmetic, conversion, truncation, or size-constraint error occurs.
    For example, when your program selects a column value into a character
    variable, if the value is longer than the declared length of the
    variable, PL/SQL aborts the assignment and raises VALUE_ERROR. In
    procedural statements, VALUE_ERROR is raised if the conversion of a
    character string into a number fails. (In SQL statements,
    INVALID_NUMBER is raised.)

    javabuzz Guest

  6. #5

    Default Re: Problems with Oracle Stored Function (Procedure)

    As far as I know, you must specify ALL Oracle SP or Function parameters in a
    proper order.
    If you are missing one or more 'cfprocparam' tags, you will be getting an
    error.

    In your case maybe on ther place of number you have a character parameter, so
    Oracle cannot conver it.

    Nicholas 11 Guest

  7. #6

    Default Re: Problems with Oracle Stored Function (Procedure)

    You used the term Function and Procedure in your topic, so I'm not sure if you
    are using the terms interchangeably or not. However, if you really meant
    function, then you can NOT call PL/SQL functions from ColdFusion, as CF can not
    handle the return value of a function. You can only call stored PL/SQL
    procedures, which would return any values back to CF as parameters or return
    sets. Period.

    Phil

    paross1 Guest

  8. #7

    Default Re: Problems with Oracle Stored Function (Procedure)

    Function call:

    <cfquery name="call_function" dsn="#mydsn#">
    select function_name() return_value
    from dual
    </cfquery>

    To access:

    <cfoutput>#call_function.return_value#</cfoutput>

    Just like from sql*plus.

    JR


    jonwrob Guest

  9. #8

    Default Re: Problems with Oracle Stored Function (Procedure)

    The only problem in this call is that you cannot use named parameters - you
    have to provide all parameters.

    Does anybody knows how to execute Oracle's Stored Procedure or Function in
    ColdFusion MX by specifying naming parameters?

    Nicholas 11 Guest

  10. #9

    Default Re: Problems with Oracle Stored Function (Procedure)

    [url]http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/[/url]
    wwhelp.htm?context=ColdFusion_Documentation&file=p art_cfm.htm


    [url]http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/[/url]
    wwhelp.htm?context=ColdFusion_Documentation&file=p art_cfm.htm

    Phil

    paross1 Guest

  11. #10

    Default Re: Problems with Oracle Stored Function (Procedure)

    Yes, I know, it's impossible with cfstoredproc...
    I was thinking about calling SP with cfquery tag, and it actually works with
    naming parameters. The only problem is how to return an output parameter from
    within Oracle BEGIN-END block as a query?

    Nicholas 11 Guest

  12. #11

    Default Re: Problems with Oracle Stored Function (Procedure)

    JR, you are correct about calling a function within a CFQUERY by SELECTing it
    from DUAL, but the oroginal poster was using CFSTOREDPROC, which can not be
    used to execute Oracle functions. I should have been more specific in my
    previous post that I was referring to using CFSTOREDPROC. Also, if you have
    functions that return values as OUT parameters, your method won't work,
    although it probably isn't a very sound practice to design functions that have
    OUT parameters anyway. :D

    Phil

    paross1 Guest

  13. #12

    Default Re: Problems with Oracle Stored Function (Procedure)

    Phil, I'm sorry you misunderstood me, but you said that you can't call a
    function from CF. That's just not true. Rob@PSA (the OP) was trying to call a
    function using CFSTOREDPROC. It doesn't work. I provided a way to call a
    function. Yes, you cannot access OUT parameters this way, but then you and I
    both know that it is VERY bad programming practice to return OUT parameters
    from functions for this very reason.

    Nicholas 11 is talking about named parameters which is a different, and
    unrelated problem. To him I would say named parameters are not supported by
    CFMX. Code around them. You have several options here, the best probably
    being changing the procedure or function to check the parameter values for
    null, and replacing them with the default value (p1 := nvl (p1, 'default
    value'))

    JR

    jonwrob Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139