Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Dynamic SQL

6 posts in Objects Last posting was on 2004-10-10 10:20:05.0Z
Cherl Beaudin Posted on 2004-07-06 16:21:12.0Z
From: "Cherl Beaudin" <cbeaudin@amerisure.com>
Newsgroups: sybase.public.powerbuilder.objects
Subject: Dynamic SQL
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
X-Original-NNTP-Posting-Host: 208.44.63.130
Message-ID: <40ead235$1@forums-2-dub>
X-Original-Trace: 6 Jul 2004 09:24:21 -0700, 208.44.63.130
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 6 Jul 2004 09:16:02 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 6 Jul 2004 09:21:12 -0700
X-Trace: forums-1-dub 1089130872 10.22.108.75 (6 Jul 2004 09:21:12 -0700)
X-Original-Trace: 6 Jul 2004 09:21:12 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:7958
Article PK: 735226

I'm trying to do a dynamic SQL and keep getting a message that the cursor
was not declared.
The code looks like this. as_RatebookID is passed in string. Any help would
be greatly appreciated.. Thanks

String ls_sqlStatement, ls_MinimumValue, ls_DataValue, ls_RatebookId,
ls_DisplayValue
int indx
DECLARE MyCursor DYNAMIC CURSOR FOR SQLSA;
n_cst_dictionary id_resultDict

For indx = 1 to Upperbound(is_tables[])

ls_sqlStatement='SELECT minimumValue, DataValue, DisplayValue'&
+' FROM AscendantOne.dbo.'+is_Tables[indx]+&
+' Where RatebookID=?'

PREPARE SQLSA FROM :ls_sqlStatement ;

OPEN DYNAMIC MyCursor using :as_ratebookID ;

Do while SQLCA.SQLCode = 0
id_resultDict = create n_cst_dictionary
FETCH MyCursor INTO :ls_minimumValue, :ls_DataValue, :ls_DisplayValue;
id_resultDict.of_at_put( 'MinimumValue', ls_minimumValue )
id_resultDict.of_at_put( 'DataValue', ls_DataValue )
id_resultDict.of_at_put( 'DisplayValue', ls_DisplayValue )
Loop

Close MyCursor;

Next

return 1


Cherl Beaudin Posted on 2004-07-06 18:15:32.0Z
From: "Cherl Beaudin" <cbeaudin@amerisure.com>
Newsgroups: sybase.public.powerbuilder.objects
References: <40ead235$1@forums-2-dub>
Subject: Re: Dynamic SQL
Lines: 51
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 208.44.63.130
X-Original-NNTP-Posting-Host: 208.44.63.130
Message-ID: <40eaec44$1@forums-1-dub>
Date: 6 Jul 2004 11:15:32 -0700
X-Trace: forums-1-dub 1089137732 208.44.63.130 (6 Jul 2004 11:15:32 -0700)
X-Original-Trace: 6 Jul 2004 11:15:32 -0700, 208.44.63.130
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:7959
Article PK: 735232

The database is MS SQL Server configured as follows
SQLCA.DBMS = "MSS Microsoft SQL Server 6.x"
SQLCA.Database = "AscendantOne"
SQLCA.LogPass = "ascendant"
SQLCA.ServerName = "fhamiaonedemo01"
SQLCA.LogId = "aoneadmin"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""

"Cherl Beaudin" <cbeaudin@amerisure.com> wrote in message
news:40ead235$1@forums-2-dub...
> I'm trying to do a dynamic SQL and keep getting a message that the cursor
> was not declared.
> The code looks like this. as_RatebookID is passed in string. Any help
would
> be greatly appreciated.. Thanks
>
> String ls_sqlStatement, ls_MinimumValue, ls_DataValue, ls_RatebookId,
> ls_DisplayValue
> int indx
> DECLARE MyCursor DYNAMIC CURSOR FOR SQLSA;
> n_cst_dictionary id_resultDict
>
> For indx = 1 to Upperbound(is_tables[])
>
> ls_sqlStatement='SELECT minimumValue, DataValue, DisplayValue'&
> +' FROM AscendantOne.dbo.'+is_Tables[indx]+&
> +' Where RatebookID=?'
>
> PREPARE SQLSA FROM :ls_sqlStatement ;
>
> OPEN DYNAMIC MyCursor using :as_ratebookID ;
>
> Do while SQLCA.SQLCode = 0
> id_resultDict = create n_cst_dictionary
> FETCH MyCursor INTO :ls_minimumValue, :ls_DataValue, :ls_DisplayValue;
> id_resultDict.of_at_put( 'MinimumValue', ls_minimumValue )
> id_resultDict.of_at_put( 'DataValue', ls_DataValue )
> id_resultDict.of_at_put( 'DisplayValue', ls_DisplayValue )
> Loop
>
> Close MyCursor;
>
> Next
>
> return 1
>
>


Bug Posted on 2004-07-08 13:16:09.0Z
From: "Bug" <fenterbug@hotmail.com>
Newsgroups: sybase.public.powerbuilder.objects
References: <40eaec44$1@forums-1-dub> <40eb1a5b.3aaa.1681692777@sybase.com> <40ebfb7d$1@forums-1-dub>
Subject: Re: Dynamic SQL
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 4.26.33.137
X-Original-NNTP-Posting-Host: 4.26.33.137
Message-ID: <40ed4919$1@forums-1-dub>
Date: 8 Jul 2004 06:16:09 -0700
X-Trace: forums-1-dub 1089292569 4.26.33.137 (8 Jul 2004 06:16:09 -0700)
X-Original-Trace: 8 Jul 2004 06:16:09 -0700, 4.26.33.137
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:7962
Article PK: 735233

A datastore is a nonvisual datawindow. It uses the datawindow object that
you create in the datawindow painter. You'll save bandwidth and some of the
server's CPU cycles with it. It will also (probably... most likely...) make
it a lot easier to get the GUID. Take a look in the help files, and if you
need more help, let us know.

"Cherl Beaudin" <cbeaudin@amerisure.com> wrote in message
news:40ebfb7d$1@forums-1-dub...
> Probably because I don't know what a datastore is?
> I did figure out what this problem was but now I have another one. I
> believe there is a conversion issue between SQL Server and Sybase.
>
> My sql looks like this.
> SELECT ratebook.id, ratebook.title, ratebook.NewBusinessEffective,
> ratebook.NewBusinessExpiration&
> FROM AscendantOne.dbo.Ratebook;
>
> The ratebook.id is a GUID they are storing as a unique identifier. In the
> table it is
> ECAF10FA-4D01-4359-9BFF-36022AAB2479
> but it's coming back to powerbase as fa10afec014d59439bff36022aab2479.
>
> Any suggestions?
>
>
>
>
>
>
> <Philip Salgannik> wrote in message
> news:40eb1a5b.3aaa.1681692777@sybase.com...
> > ANy reason for using dynamic SQL instead of a datastore?
> >
> > > The database is MS SQL Server configured as follows
> > > SQLCA.DBMS = "MSS Microsoft SQL Server 6.x"
>
>


RP Posted on 2004-10-10 10:20:05.0Z
Sender: 53c6.41690bca.1804289383@sybase.com
From: RP
Newsgroups: sybase.public.powerbuilder.objects
Subject: Re: Dynamic SQL
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <41690cd1.53d0.1681692777@sybase.com>
References: <40ead235$1@forums-2-dub>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 10 Oct 2004 03:20:01 -0700, 10.22.241.42
Lines: 45
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 10 Oct 2004 03:20:02 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 10 Oct 2004 03:20:05 -0700
X-Trace: forums-1-dub 1097403605 10.22.108.75 (10 Oct 2004 03:20:05 -0700)
X-Original-Trace: 10 Oct 2004 03:20:05 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.objects:8037
Article PK: 735307

close the cursor after the loop...

thx
RP

> I'm trying to do a dynamic SQL and keep getting a message
> that the cursor was not declared.
> The code looks like this. as_RatebookID is passed in
> string. Any help would be greatly appreciated.. Thanks
>
> String ls_sqlStatement, ls_MinimumValue, ls_DataValue,
> ls_RatebookId, ls_DisplayValue
> int indx
> DECLARE MyCursor DYNAMIC CURSOR FOR SQLSA;
> n_cst_dictionary id_resultDict
>
> For indx = 1 to Upperbound(is_tables[])
>
> ls_sqlStatement='SELECT minimumValue, DataValue,
> DisplayValue'&
> +' FROM AscendantOne.dbo.'+is_Tables[indx]+&
> +' Where RatebookID=?'
>
> PREPARE SQLSA FROM :ls_sqlStatement ;
>
> OPEN DYNAMIC MyCursor using :as_ratebookID ;
>
> Do while SQLCA.SQLCode = 0
> id_resultDict = create n_cst_dictionary
> FETCH MyCursor INTO :ls_minimumValue, :ls_DataValue,
> :ls_DisplayValue;
> id_resultDict.of_at_put( 'MinimumValue', ls_minimumValue
> )
> id_resultDict.of_at_put( 'DataValue', ls_DataValue )
> id_resultDict.of_at_put( 'DisplayValue', ls_DisplayValue
> )
> Loop
>
> Close MyCursor;
>
> Next
>
> return 1
>
>