[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Problem calling an Oracle stored procedure from SQR



We're using SQR 4.3.4 to generate workorders in Maximo on Oracle 8i
connecting with the Oracle 8.01.07.00 ODBC driver. One part of my program
must copy a Maximo long description from a template record to a workorder
record. The long description record consists of a key field (numeric), a
field for table and column names (both varchar2) and the long description
text (Oracle long datatype).

Some of the long description texts are VERY long and getting truncated when
copying them through SQR. I was reading the text into an SQR column variable
(&ldtext), then writing that column variable to another long column. That
method works for all but a few of the longest text values.

To get around the limitation of working with Oracle long datatypes in SQR,
we wrote an Oracle function to do the copy. The function takes six
parameters: source key, source table, source column, destination key,
destination table and destination column. The function then copies the text
from the source row to the destination row. All three fields (key, table
name and column name) are required to identify a unique row since the key
alone may not be unique. The function returns a numeric error code.


Here's the SQR code I'm using to load the parameters and call the function:

    move    'JOBOPERATION' to $source_table
    move    'DESCRIPTION'  to $source_column
    move    &wpldkey       to $source_ldkey
    move    'WPOPERATION'  to $dest_table
    move    'DESCRIPTION'  to $dest_column
    move    #wpoldkey      to $dest_ldkey

    let $parms =    '''' || $source_table || '''' || ', ' || '''' ||
$source_column || '''' || ', '
                         || '''' || $source_ldkey || '''' || ', ' || '''' ||
$dest_table || ''''
                         || ', ' || '''' || $dest_column || '''' || ', ' ||
'''' || $dest_ldkey || ''''

    #debug show 'Parms: ' $parms

    begin-sql -db'DSN=MXNS;UID=XXXXXX;PWD=xxxxx' On-Error=Oracle-Write-Error
        begin
            #lderrcode := ins_ldtext([$parms]);;
        end;;
    end-sql

The #debug show statement to display the parameter list results in:
Parms: 'JOBOPERATION', 'DESCRIPTION', '2146613734', 'WPOPERATION',
'DESCRIPTION', '2122464'


When I call the Oracle ins_ldtext function, I get this error:

PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
following:

   . ( * % & = - + ; < / > at in mod not rem <an exponent (**)>
   <> or != or ~= >= <= <> and or like between is null is not ||
   is dangling


error number: 6550.000000


I've also tried calling the function with #lderrcode := ins_ldtext($parms);;
(same call as above without the square brackets) and get the same error.

Can anyone see where my code is going south? Is there a limit to the number
of parameters I can pass to an Oracle function from SQR or the length of the
parm list?