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     Passing a set variable to an sqlout query?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Passing a set variable to an sqlout query?
 Login/Join
 
Gold member
posted
Can anyone give me a hand with this please. Im trying to pass a date variable into and sqlout query and it keeps giving me an
...RETRIEVAL KILLED
0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0
(FOC1400) SQLCODE IS -180 (HEX: FFFFFF4C)
: [22007] [IBM][CLI Driver][DB2] SQL0180N The syntax of the string repres
: entation of a datetime value is incorrect. SQLSTATE=22007
L (FOC1406) SQL OPEN CURSOR ERROR. : SQLOUT

error.


I am setting a varible in the fex up above as so.
-SET &DATE_BEGIN_CURRENT_MONTH=DATECVT(&DATE1C, 'YYMD', 'I8YYMD');
-SET &DATE_PRIV_MTH_END=DATECVT(&DATE1, 'YYMD', 'I8YYMD');


and here is the part of the query im trying to pass it too.

AND DATE(P.PROCESS_DATE) BETWEEN DATE('&DATE_BEGIN_CURRENT_MONTH') AND DATE('&DATE_PRIV_MTH_END')


I must have this wrong somehow, any help woiuld be greatly appreciated.


Thanks


WF 7.1.7- Windows XP
 
Posts: 63 | Registered: August 28, 2007Report This Post
Expert
posted Hide Post
Show us the SQL command with the embedded date values.

What does DATE(P.PROCESS_DATE) do?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
You shouldn't need to use DATECVT to convert the Dialogue Manager variables from date to integer - they're already string values.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
SQL DB2 PREPARE SQLOUT FOR
SELECT O.office_desc || ' - ' || O.office_Code as strOffice,O.OFFICE_ID, O.OFFICE_DESC as Office_desc, O.OFFICE_CODE,CY.County_Name,CY.County_code,
SUM(P.PAYMENT_AMOUNT) AS COLLECTIONS
FROM DB2ADMIN.TKPAYMT P
INNER JOIN DB2ADMIN.TKCASE C ON C.CASE_ID = P.CASE_ID
INNER JOIN DB2ADMIN.tkcnty CY on CY.County_Code = C.County_Code
INNER JOIN DB2ADMIN.TKCAHIS CH ON CH.CASE_ID = C.CASE_ID
INNER JOIN DB2ADMIN.TKHIST H ON H.HISTORY_ID = CH.HISTORY_ID
INNER JOIN DB2ADMIN.TKSTAGE S ON S.STAGE_ID = H.STAGE_ID
INNER JOIN DB2ADMIN.TKOFFIC O ON O.OFFICE_ID = H.OFFICE_ID
WHERE o.OFFICE_ID <> 0
AND P.STATUS_ID = 25
and C.Case_type_id = 1
AND DATE(P.PROCESS_DATE) BETWEEN DATE('&DATE_BEGIN_CURRENT_MONTH') AND DATE('&DATE_PRIV_MTH_END')


WF 7.1.7- Windows XP
 
Posts: 63 | Registered: August 28, 2007Report This Post
Gold member
posted Hide Post
I thought it was the way i coded the set dates into the sql query i.e. BETWEEN DATE('&DATE_BEGIN_CURRENT_MONTH') AND DATE('&DATE_PRIV_MTH_END')


WF 7.1.7- Windows XP
 
Posts: 63 | Registered: August 28, 2007Report This Post
Expert
posted Hide Post
quote:
AND DATE(P.PROCESS_DATE) BETWEEN DATE('&DATE_BEGIN_CURRENT_MONTH') AND DATE('&DATE_PRIV_MTH_END')


What is the translated result of this line of code? I'd like to see the amper values.

And, what does DATE(P.PROCESS_DATE) do? Does it isolate the Date portion of a DateTime column?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
yes it isolates the date portion. Let me see if i can print the amper values.


WF 7.1.7- Windows XP
 
Posts: 63 | Registered: August 28, 2007Report This Post
Gold member
posted Hide Post
(FOC1517) UNRECOGNIZED COMMAND WHERE (H.OFFICE_ID IS NULL OR H.OFFICE_ID = 0 )
(FOC1517) UNRECOGNIZED COMMAND AND DATE(P.PROCESS_DATE) BETWEEN '20080601' AND
'20080623'


I do not think i can pass variables to an sqlout query. But anyway, the values came out as '20080601' and '20080623'


WF 7.1.7- Windows XP
 
Posts: 63 | Registered: August 28, 2007Report This Post
Expert
posted Hide Post
Well, you can pass variables in SQL. People do it all the time. I think your problem with the dates might be, since you are doing passthru, is that the date is not in the correct format. I'm not sure what DB2's is but it might need dashes, i.e. 2008-06-01, etc.

I am also concerned about your first FOC1517 in your most recent post. That suggests that you screwed up the SQL somehow as that error has nothing to do with dates.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Gold member
posted Hide Post
Oh, im sorry, i made it error out like that so i could see the values being passed in the between. I pass values to db2's queries all the time but this is the first time i tried to do it while using the sqlout feature.


WF 7.1.7- Windows XP
 
Posts: 63 | Registered: August 28, 2007Report This Post
Expert
posted Hide Post
Try coding the dates with dashes, as Ginny suggests.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
If you want to see the variables, put this in your program:

-SET &ECHO=ALL;

If you want to do that and just see the code and not run the SQL, put this in your program:

SET XRETRIEVAL=OFF


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Master
posted Hide Post
How is your date defined in the database? If it is DATE rather than TIMESTAMP it is a numeric field. Two things to try, #1 change DATE(P.PROCESS_DATE) BETWEEN DATE('&DATE_BEGIN_CURRENT_MONTH') AND DATE('&DATE_PRIV_MTH_END')

TO:
to_date(P.PROCESS_DATE,'YYYYMMDD') BETWEEN TO_DATE('&DATE_BEGIN_CURRENT_MONTH','YYYYMMDD') AND TO_DATE('&DATE_PRIV_MTH_END','YYYYMMDD')


#2 take the quotes off of your between dates.


In the code you supplied, I don't see:
WHERE (H.OFFICE_ID IS NULL OR H.OFFICE_ID = 0 )


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report 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     Passing a set variable to an sqlout query?

Copyright © 1996-2020 Information Builders