cancel
Showing results for 
Search instead for 
Did you mean: 

please help stored procedure not executing

Former Member
0 Kudos

My  code is as follows

DECLARE spgetname PROCEDURE FOR spGetName @Customer = :ls_customer, @Type = :ls_type, @CName = :ls_name  OUTPUT USING SQLCA; EXECUTE spgetname ; do while sqlca.sqlcode = 0 FETCH spgetname  INTO :s_message; if sqlca.sqlcode = 0 then MessageBox( "s_message", s_message) end if Loop

I am using pb11.2 and SqlServer snc connection. the procedure is not calling. Even when I am giving wrong procedure name , no error message is coming. Please looking for your help Regards Pol

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

What Paul said.  But let's take a step back.  What does your procedure return to the application?  Is it a resultset?  an output argument?  the return value?  All three? More than one but less than three?  It is best to pick most appropriate implementation in order to make things easier (and safer and more efficient) for the application.

Next, you need to learn to code defensively.  Don't assume that every call succeeds.  You check for an error once in your code yet there are multiple functions that can fail.  Using dynamic sql in PB is very different from using a datawindow control - there is no default implementation that will automatically display error messages when a function returns an error, you must write code to do that. I'll also point out that you can trace your database connection - something that can be very useful when you are experiencing unexplained connectivity problems.

Lastly, you've posted a series of questions about RPCs, stored procedures, sql server and PB.  A few seem to revolve around the idea that you want to avoid declaring the RPC in your application for some strange reason.  I think it would be good to explain your reasoning since the RPC approach is the easiest to implement BY FAR (assuming that your procedure does not return a resultset).

Former Member
0 Kudos

Many Thanks I sorted it calling RPCFUNC

Former Member
0 Kudos

I'll never understand why people continue to use the embedded SQL method for calling stored procedures.  Old habits die hard, I guess...

I write all mine with input parameters only (no output parameters, EVER) and have them return a result set with a final SELECT statement.  Then I use a datawindow to invoke it with the Retrieve() method. 

No messy embedded SQL, and having to get the syntax of the Declare/Execute/Close statements just perfect.  And no Fetch loops because you have the full power of the dw Primary buffer at your disposal.

-Paul-

Former Member
0 Kudos

It should be worked woth output parameter. Because Sybase have explained in their help document

DECLARE logical_procedure_name PROCEDURE FOR SQL_Server_procedure_name @Param1 = value1, @Param2 = value2, @Param3 = value3 OUTPUT, {USING transaction_object} ;

Former Member
0 Kudos

I'm not saying it doesn't work...  I've offered an alternate solution that is much easier to implement, less complex to maintain, and faster in overall performance than using embedded SQL.