Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     SQL Question - VALUES NEXT

Read-Only Read-Only Topic
Go
Search
Notify
Tools
SQL Question - VALUES NEXT
 Login/Join
 
Virtuoso
posted
I am helping our Data Migrator guys with some processes and it appears that one of the tables he will update uses a DB2 sequence(?) I'm not exactly sure how that works but the gist is that using the statement VALUES( NEXT VALUE FOR dbname.tbname); it requests the next available sequence number and increments. If I execute that statement in a native SQL tool, it returns the value of the next sequence number (and increments it.) If I stick that same statement into SQL passthru, the sequence is incremented but it does not return any value. I need to be able to see that value for some further processing.

Has anyone used this statement for DB2 (or other) and is there a trick to capturing that returned value in WF (either as a returned data set or in a return code or variable?)


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Gold member
posted Hide Post
Darin:
I've not used this is DB2, but in Oracle, you do a SELECT .CURRVAL FROM DUAL to get the current value. There might be something similar for DB2. And then, you put the SQL ti increment and the SQL to retrieve into one transaction (to avoid the possibility of getting the wrong value back).


Diptesh
WF 7.1.7 - AIX, MVS
 
Posts: 79 | Location: Warren, NJ, USA | Registered: October 25, 2006Report This Post
Virtuoso
posted Hide Post
What I was saying is that there is no separate SQL for the retrieval and for the increment. DB2 knows what that statement is supposed to do and does everything necessary in a single step. It works in a native SQL tool, but WF does not seem to return the value, but does increment it. I guess I could possibly create a stored procedure which would require WF to explicitly wait for a returned value from the procedure. Never used a stored procedure, so I don't quite know how that works. Will have to look into that.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Platinum Member
posted Hide Post
Darin,

I've never used DB2 sequnces, but the DB2 documentation implies that you can use these in a standard select statement. So if you wanted to see the sequence value you just created you could do:

select PREVIOUS VALUE FOR my_sequence from any_table

EricH
 
Posts: 164 | Registered: March 26, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     SQL Question - VALUES NEXT

Copyright © 1996-2020 Information Builders