Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    13

    Unanswered: Sybase IQ - Call stored procedure from UNIX shell script.

    Hi All,

    I am using SYBASE IQ.

    I have written a function, which will connect to Sybase DB and perform the action given as a parameter.
    Code:
    RunSybaseSQL ()
    {
    eval isql -w999 -S$Serv_name -I$intfile -U$SYB_UID -P$sybase_paswd <<finis >${TMPDIR}/report.log.$$ 2>&1
    $1
    go
    finis
    }

    Now i am calling this function to execute the procedure(empdept) as below.

    Code:
    tt=20100413
    tb=employee
    ind=Y
    num=10
    typ=XXX
    
    RunSybaseSQL "exec empdept('${tt}','${tb}','${ind}','${num}','${typ}')"
    But this gives me an error

    Code:
    Msg 102, Level 15, State 0:
    ASA Error -131: Syntax error near 'exec' on line 1
    I do not what is the problem is. I have tried all way ie writing exec empdept in function it self or removing single quotes in procedure peremeters.
    but of no use.

    Can someone help me on this?

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Any way to see what string is sent to Sybase after the shell/perl script generates it?

  3. #3
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Is this valid syntax in IQ?
    exec empdept('20100413','employee','Y','10','XXX')

    Maybe you should remove the brackets
    Also I don't think you need eval

  4. #4
    Join Date
    Nov 2003
    Posts
    1

    call vs exec

    I don't know which is better, but there is a difference between call and exec:

    if you are logged in as "owner" and you have a procedure named "sp_procedure_name" that does not take parameters

    these two work:
    call owner.sp_procedure_name()
    exec owner.sp_procedure_name

    this does not:
    exec owner.sp_procedure_name()

    Sorry but I don't have time right now to provide example with parameters.

Posting Permissions

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