Returning a value from a SQL Anywhere function to Power++

I have a SQL Anywhere function that returns a value. How do I get this
return value into a memory variable in Power++? Thanks,

Jim

0
Jim
6/18/1997 9:50:28 AM
sybase.sqlanywhere.general 32637 articles. 4 followers. Follow

4 Replies
459 Views

Similar Articles

[PageSpeed] 45

You probably are better of returning a result set instead.

SELECT MyFunction(SomeParm) FROM dummy;

-- 
Jim Egan [TeamPS]
Dealer Solutions, LLC
Houston, TX

Jim Kist <kist@buffnet.net> wrote in article
<01bc7bd5$b21e9350$09006480@dev>...
> I have a SQL Anywhere function that returns a value. How do I get this
> return value into a memory variable in Power++? Thanks,
> 
> Jim
> 
> 
0
Jim
6/18/1997 11:23:42 AM
"Jim Kist" <kist@buffnet.net> wrote:

>I have a SQL Anywhere function that returns a value. How do I get this
>return value into a memory variable in Power++? Thanks,
>
>Jim
>

I don't know Power++, but you would return a function value the same
as any other value.  In PB it would be something like:

  SELECT foo(parm1) FROM dummy;


0
72330
6/18/1997 11:26:08 PM
--------------A0552966601972D7EB087CAE
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Leo:

From what I read of your question, I don't think either of the answers
so far addresses it.  I have done something very similar.  I have a
stored procedure on the server that gives me a one-up number.  It is an
Oracle sequence, and you have to do a SELECT into a variable to get the
number.  It isn't as automatic as the autoincrement field in Access.  In
any case, the sequence itself on the server looks like:

CREATE OR REPLACE PROCEDURE getNextTransID(new_id out integer) is BEGIN
select rig_transaction_id.nextval into new_id from dual;

END;

It has one argumetn, that is returned.  In my Optima code, I have a
function that invokes this called procedure and it looks like this:

int Form1::getNextTransactionID( void )
{
    int     transactionID = -1 ;
    int     dum ;
    WBool   success ;

    // Use the query_1 object to execute a select statement to get the
next value from the
    // the rig_transaction_id sequence since the identity column
property of the dw doesn't
    // work with Oracle sequences.

    success = query_1->Close() ;
    success = query_1->BindParameter((WShort) 1,WQPTOutput, SQL_C_LONG,
SQL_INTEGER,
        (UDWORD) 1,1,(void *) &transactionID,(SDWORD) 0,(SDWORD *) &dum)
;

    // Call a stored procedure getnexttransid() which in turn issues a
select on the Oracle sequence called
    // rig_transaction_id to get a one-up #.

    success = query_1->SetSQL( "{call getnexttransid(?)}" );
    success = query_1->Open(TRUE) ;


    return transactionID ;

}

The open() will run the SQL part and the BindParameter() takes care of
putting the result into the Optima variable.  Hope this helps.

Mike

Leo Tohill wrote:

> "Jim Kist" <kist@buffnet.net> wrote:
>
> >I have a SQL Anywhere function that returns a value. How do I get
> this
> >return value into a memory variable in Power++? Thanks,
> >
> >Jim
> >
>
> I don't know Power++, but you would return a function value the same
> as any other value.  In PB it would be something like:
>
>   SELECT foo(parm1) FROM dummy;



--------------A0552966601972D7EB087CAE
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
Leo:

<P>From what I read of your question, I don't think either of the answers
so far addresses it.&nbsp; I have done something very similar.&nbsp; I
have a stored procedure on the server that gives me a one-up number.&nbsp;
It is an Oracle sequence, and you have to do a SELECT into a variable to
get the number.&nbsp; It isn't as automatic as the autoincrement field
in Access.&nbsp; In any case, the sequence itself on the server looks like:

<P><B><FONT SIZE=-1>CREATE OR REPLACE PROCEDURE getNextTransID(new_id out
integer) is BEGIN</FONT></B>
<BR><B><FONT SIZE=-1>select rig_transaction_id.nextval into new_id from
dual;</FONT></B><B><FONT SIZE=-1></FONT></B>

<P><B><FONT SIZE=-1>END;</FONT></B><B></B>

<P>It has one argumetn, that is returned.&nbsp; In my Optima code, I have
a function that invokes this called procedure and it looks like this:

<P>i<B><FONT SIZE=-1>nt Form1::getNextTransactionID( void )</FONT></B>
<BR><B><FONT SIZE=-1>{</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; int&nbsp;&nbsp;&nbsp;&nbsp; transactionID
= -1 ;</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; int&nbsp;&nbsp;&nbsp;&nbsp; dum
;</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; WBool&nbsp;&nbsp; success ;</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; // Use the query_1 object to execute
a select statement to get the next value from the</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; // the rig_transaction_id sequence
since the identity column property of the dw doesn't</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; // work with Oracle sequences.</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; success = query_1->Close() ;</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; success = query_1->BindParameter((WShort)
1,WQPTOutput, SQL_C_LONG, SQL_INTEGER,</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (UDWORD)
1,1,(void *) &amp;transactionID,(SDWORD) 0,(SDWORD *) &amp;dum) ;</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; // Call a stored procedure getnexttransid()
which in turn issues a select on the Oracle sequence called</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; // rig_transaction_id to get a
one-up #.</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; success = query_1->SetSQL( "{call
getnexttransid(?)}" );</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; success = query_1->Open(TRUE) ;</FONT></B>
<BR><B><FONT SIZE=-1>&nbsp;</FONT></B><B><FONT SIZE=-1></FONT></B>

<P><B><FONT SIZE=-1>&nbsp;&nbsp;&nbsp; return transactionID ;</FONT></B><B><FONT SIZE=-1></FONT></B>

<P><B><FONT SIZE=-1>}</FONT></B>

<P>The open() will run the SQL part and the BindParameter() takes care
of&nbsp; putting the result into the Optima variable.&nbsp; Hope this helps.

<P>Mike
<BR>

<P>Leo Tohill wrote:
<BLOCKQUOTE TYPE=CITE>"Jim Kist" &lt;kist@buffnet.net> wrote:

<P>>I have a SQL Anywhere function that returns a value. How do I get this
<BR>>return value into a memory variable in Power++? Thanks,
<BR>>
<BR>>Jim
<BR>>

<P>I don't know Power++, but you would return a function value the same
<BR>as any other value.&nbsp; In PB it would be something like:

<P>&nbsp; SELECT foo(parm1) FROM dummy;</BLOCKQUOTE>
&nbsp;</HTML>

--------------A0552966601972D7EB087CAE--

0
mike
6/20/1997 9:39:36 PM
Mike, 

It wasn't I who posted the question - I imagine you meant to respond
to Jim Kist. 

Reqarding the question, he asked about getting the result of a stored
function, which is a straighforward thing compared to calling a stored
procedure. 

Regards,




mike gaffney <mgaffney@mrj.com> wrote:

>Leo:
>
>From what I read of your question, I don't think either of the answers
>so far addresses it.  I have done something very similar.  I have a
>stored procedure on the server that gives me a one-up number.  It is an
>Oracle sequence, and you have to do a SELECT into a variable to get the
>number.  It isn't as automatic as the autoincrement field in Access.  In
>any case, the sequence itself on the server looks like:
>

Leo Tohill - Team Powersoft
0
72330
6/22/1997 5:38:12 PM
Reply:

Similar Artilces:

function return value in sql anywhere 5.04
i have created a store procedure which will call a function (return decimal value),however, the function return value always be integer. For example: FUNCTION: create function fun_1() begin declare ret_1 decimal(10,2) select ret_1 = 1.23 return ret_1 end STORE PROCEDURE create procedure begin declare var_1 decimal(10,2) ....... select var_1 = fun_1() end Then, the result for var_1 is always 1 instead of 1.23. Is that any idea This question was answered in the other thread that you began. Leo Tohill - Team Powersoft -- Please post in newsgroup, not via email &...

superreview granted: [Bug 270342] In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" : [
David Bienvenu <bienvenu@nventure.com> has granted Serge GAUTHERIE <gautheri@noos.fr>'s request for superreview: Bug 270342: In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" https://bugzilla.mozilla.org/show_bug.cgi?id=270342 Attachment 168078: (Av2b) <threadPane.js> https://bugzilla.mozilla.org/attachment.cgi?id=168078&action=edit ...

superreview cancelled: [Bug 270342] In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" :
neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> has cancelled Serge GAUTHERIE <gautheri@noos.fr>'s request for superreview: Bug 270342: In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" https://bugzilla.mozilla.org/show_bug.cgi?id=270342 Attachment 166201: (Av1) <threadPane.js> https://bugzilla.mozilla.org/attachment.cgi?id=166201&action=edit ------- Additional Comments from neil@parkwaycc.co.uk <neil.parkw...

superreview requested: [Bug 270342] In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" : #2
Serge GAUTHERIE <gautheri@noos.fr> has asked David Bienvenu <bienvenu@nventure.com> for superreview: Bug 270342: In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" https://bugzilla.mozilla.org/show_bug.cgi?id=270342 Attachment 166201: (Av1) <threadPane.js> https://bugzilla.mozilla.org/attachment.cgi?id=166201&action=edit ...

superreview requested: [Bug 270342] In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" : #3
Serge GAUTHERIE <gautheri@noos.fr> has asked David Bienvenu <bienvenu@nventure.com> for superreview: Bug 270342: In <threadPane.js>, "Warning: function MsgSortThreadPane does not always return a value" and "Warning: function MsgToggleThreaded does not always return a value" https://bugzilla.mozilla.org/show_bug.cgi?id=270342 Attachment 168078: (Av2b) <threadPane.js> https://bugzilla.mozilla.org/attachment.cgi?id=168078&action=edit ...

Returning Values from a SQL Anywhere Database Procedure
HELP! I have a local external function (SQL Anywhere procedure) defined in the n_tr object with some REF arguements. The arguments are defined as OUT parameters in the database procedure. However, in the itemchanged event in my datawindow control object, after executing the procedure, the local variables used for the arguments are empty. This seems to have also occurred with my colleague with another procedure and he finally set up a datastore and then had the DB procedure return the values using the RESULT keyword (rather than using OUT parameters in the argument list). Everythi...

How to pass a C# function return value via a asp:Parameter to a sql query
Im currently using a C# function that returns the client username, its located in myASP.aspx.cs public string userName() {   return dummyUserName;} How do I pass a the returnvalue (i.e dummyUserName) as a parameter from myASP.aspx to a sql-query for example? I'm confused.  Are you trying to get access to the variable in client-side script?  How would you pass a known string to your example sql-query? What I'm tying to do is to use the logged in user's name as a parameter in my query (sql select statement). The aspx pass parameters to the query (i.e < asp:Pa...

SQL Table Valued Function: Problem returning concatenated fields in single column
I have a SQL table valued function, which I would like to return a table with single column of type text that has various column values concatenated. All works fine when the column values being concatenated are NOT of type text. However, when one of the columns being concatenated has a value of type text, I have to split the text value down into sub-strings and cast each substring as varchar(8000). My problem is when I run the function, the result data gets cutt-off where the text column value reaches 8000. I thiught about using UPDATESTRING function, but was not sure how I would be ...

superreview cancelled: [Bug 242208] JavaScript strict warning in mailWindowOverlay.js: function MsgOpenFromFile does not always return a value : [Attachment 147397] removing useless return values
Karsten "Mnyromyr" D�sterloh <mnyromyr@tprac.de> has cancelled Karsten "Mnyromyr" D�sterloh <mnyromyr@tprac.de>'s request for superreview: Bug 242208: JavaScript strict warning in mailWindowOverlay.js: function MsgOpenFromFile does not always return a value http://bugzilla.mozilla.org/show_bug.cgi?id=242208 Attachment 147397: removing useless return values http://bugzilla.mozilla.org/attachment.cgi?id=147397&action=edit ...

superreview requested: [Bug 242208] JavaScript strict warning in mailWindowOverlay.js: function MsgOpenFromFile does not always return a value : [Attachment 147397] removing useless return values
Karsten "Mnyromyr" D�sterloh <mnyromyr@tprac.de> has asked David Bienvenu <bienvenu@nventure.com> for superreview: Bug 242208: JavaScript strict warning in mailWindowOverlay.js: function MsgOpenFromFile does not always return a value http://bugzilla.mozilla.org/show_bug.cgi?id=242208 Attachment 147397: removing useless return values http://bugzilla.mozilla.org/attachment.cgi?id=147397&action=edit ...

superreview requested: [Bug 294989] In <editorInlineSpellCheck.js>, 4 "Warning: anonymous function does not always return a value" : [Attachment 186968] trivially remove all unused return values
Karsten "Mnyromyr" D�sterloh <mnyromyr@tprac.de> has asked Dan Mosedale <dmose@mozilla.org> for superreview: Bug 294989: In <editorInlineSpellCheck.js>, 4 "Warning: anonymous function does not always return a value" https://bugzilla.mozilla.org/show_bug.cgi?id=294989 Attachment 186968: trivially remove all unused return values https://bugzilla.mozilla.org/attachment.cgi?id=186968&action=edit ------- Additional Comments from Karsten "Mnyromyr" D�sterloh <mnyromyr@tprac.de> All these return values are unused and can be remove...

superreview granted: [Bug 294989] In <editorInlineSpellCheck.js>, 4 "Warning: anonymous function does not always return a value" : [Attachment 186968] trivially remove all unused return values
Dan Mosedale <dmose@mozilla.org> has granted Karsten "Mnyromyr" D�sterloh <mnyromyr@tprac.de>'s request for superreview: Bug 294989: In <editorInlineSpellCheck.js>, 4 "Warning: anonymous function does not always return a value" https://bugzilla.mozilla.org/show_bug.cgi?id=294989 Attachment 186968: trivially remove all unused return values https://bugzilla.mozilla.org/attachment.cgi?id=186968&action=edit ------- Additional Comments from Dan Mosedale <dmose@mozilla.org> sr=dmose ...

Web resources about - Returning a value from a SQL Anywhere function to Power++ - sybase.sqlanywhere.general

Returning - Wikipedia, the free encyclopedia
In retail , returning is the process of a customer taking previously purchased merchandise back to the retailer, and in turn, receiving a cash ...

Mark Zuckerberg Returning To TechCrunch Disrupt
Facebook Co-Founder and CEO Mark Zuckerberg took the stage at last year’s TechCrunch Disrupt conference in San Francisco, where he discussed ...

How-to: Improve the Experience for Returning Users
... – your inbox, your favorite news sources, or your friends’ activity. If you’ve integrated Facebook Login on your website, you can give returning ...

Search Twitter - emilia-clarke-not-returning
Sign in Sign up No results for emilia-clarke-not-returning Settings Help Back to top · Turn images off

Is the Returning CEO a Trend?
... well be wondering if it is a new trend for boards to reach back into their alumni ranks to bring back a CEO when a company is in Is the Returning ...

Fire engine returning from a call
District of Columbia Fire & EMS Station No. 3

Zillow: Long Distance (Returning Soldier Commercial) - YouTube
Introducing Zillow's latest TV commercial as part of its national advertising campaign, "Find Your Way Home." The spot, entitled "Long Distance," ...

WWE’s Daniel Bryan on WWE 2K16, facing Brock Lesnar at WrestleMania, returning to the ring and life on ...
The four-time WWE world champion discusses whether it is right for Stone Cold Steve Austin to be the cover star of WWE 2K16, as well as who he ...

Damn Fine News of the Day: Kyle MacLachlan is Returning to ‘Twin Peaks’
In case you missed it, David Lynch announced on Twitter Monday that Kyle MacLachlan will reprise his role as Special Agent Dale Cooper in the ...

Returning Cat Daniel Menzel hopes for a pain-free summer
Having starred in his first match in almost four years, Geelong forward Daniel Menzel says his next major challenge is to train - pain free - ...

Resources last updated: 11/25/2015 1:15:59 AM