Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014
    Posts
    11

    Question Unanswered: stored procedure - execute passed in param as sql command

    Hi All,

    I hope this isn't a dumb question. I am using Sybase 15.5 on Linux. I have a system written in C that interfaces with Sybase via dbapi calls. In one instance, I want to dynamically create an 'update' statement in my c program, pass that in to a stored proc, and have that passed in param execute as a normal sql statement. Is this possible?

    e.g.,
    Sybase table:
    my_table contains col1, col2, col3, col4 and col5.

    C program creates a string: "update my_table set col1='x', col5='y'"
    C program then calls stored procedure called 'update_my_table' via the C/Sybase api interface

    stored procedure 'update_my_table' has a single input para ('statement_to_execute varchar(255)). HOW do I, within that stored procedure, execute the statement provided in the input parameter?

    I hope I explained this well. If not, I apologize.

    thanks
    Bill

  2. #2
    Join Date
    May 2014
    Posts
    11

    Question impossible?

    Hi All, I am guessing by all of the views and no replies that it isn't possible to do what I would like to do (below). It would be nice if there was a way to dynamically build a sql statement (say, an update statement to a table), pass that in to a stored procedure, and have it execute. I ran some timing on my C program (heavy database usage...lots of updates and inserts) and there is a case where I dynamically build an 'update table' statement then call the Sybase C api to execute the statement. My timing feed feedback shows that one sql interaction takes more time then it probably should. Thus; I thought I could streamline it by running the sql statement within a stored procedure.

    thanks
    Bill

    Quote Originally Posted by boomer11 View Post
    Hi All,

    I hope this isn't a dumb question. I am using Sybase 15.5 on Linux. I have a system written in C that interfaces with Sybase via dbapi calls. In one instance, I want to dynamically create an 'update' statement in my c program, pass that in to a stored proc, and have that passed in param execute as a normal sql statement. Is this possible?

    e.g.,
    Sybase table:
    my_table contains col1, col2, col3, col4 and col5.

    C program creates a string: "update my_table set col1='x', col5='y'"
    C program then calls stored procedure called 'update_my_table' via the C/Sybase api interface

    stored procedure 'update_my_table' has a single input para ('statement_to_execute varchar(255)). HOW do I, within that stored procedure, execute the statement provided in the input parameter?

    I hope I explained this well. If not, I apologize.

    thanks
    Bill

Posting Permissions

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