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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Date issue
 Login/Join
 
Member
posted
Hi,
I have a problem with date in WF769. Im trying to fetch the date using a SQL and formatting it to MM-DD-YYYY but it is giving me junk cahracters. Any help on this would be great.

SQL SQLORA
SELECT  TO_CHAR(T2.WK_BEG_D,'MM-DD-YYYY') WEEK_BEG_D, TO_CHAR(SYSDATE,'MM-DD-YYYY') CURR_DATE, T2.ACCT_MO_N
AS MONTH_NAME FROM ACCT T1, ACCT T2
WHERE  T2.ACCT_D = (T1.WK_BEG_D-1)
AND T1.ACCT_D = TO_CHAR(SYSDATE, 'DD-MON-YY' );
 
TABLE FILE SQLOUT
PRINT
*
ON TABLE HOLD FORMAT ALPHA
END
 
-RUN
-READ HOLD &WEEK_BEG_D.A10. &CURR_DATE.A10. &MONTH_NAME.A10.

-TYPE &CURR_DATE


I get the following error Frowner

001001-29-
(FOC1400) SQLCODE IS 1843 (HEX: 00000733)
: ORA-01843: not a valid month
L (FOC1406) SQL OPEN CURSOR ERROR. : SQLOUT


Thanks in advance
LG

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 11 | Registered: November 17, 2010Report This Post
Expert
posted Hide Post
My guess is that the field is a varable length char field.

The first 4 digits indicate the size.

If you print the field WEEK_BEG_D with the format /A10, it should fix the problem.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
<JG>
posted
I think Waz is on the correct track but the error is being returned by Oracle.

The error in that case is in the SQL select not the TABLE FILE
 
Report This Post
Member
posted Hide Post
Thanks Waz and JG, will give it a try

Just to clarify, the SQL returns perfect results when executed from Oracle clients like TOAD/SQLDeveloper

LG


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 11 | Registered: November 17, 2010Report This Post
Expert
posted Hide Post
If you want to know what the format is, add a ?FF after the TABLE FILE xxx or ? HOLD after the END


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
Use DATETRAN function in define and change it to Character format and create a hold table. And then read the hold table and assign to variable.

Smiler


WebFOCUS 7 6 9
Windows XP
HTML, AHTML, PDF, EXCEL
 
Posts: 24 | Registered: April 24, 2009Report This Post
Member
posted Hide Post
This is what i get when i ?FF
WEEK_BEG_D E01 A10V
CURR_DATE E06 A10V

Not sure what the V in A10V stands for....Any help?

I have been struggling with this for quite sometime, all only to fetch the current date from DB in the desired format and display on the report Frowner Any help??

Thanks in advance

LG


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 11 | Registered: November 17, 2010Report This Post
Virtuoso
posted Hide Post
The V stands for Variable. That means that the data is stored in the hold file preceded by a 6 character number that indicates the length of the field. So in your case is will be 6 bytes length, 10 bytes for WEEK_BEG_D, 6 bytes length and 10 bytes for CURR_DATE. Your read statement should therefor be:
-READ HOLD &var.6. &WEEK_BEG_D.10. &var.6. &CURR_DATE.10.
this should produce the desired result.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
The error suggests the problem is in the Oracle SQL pass-through step, not in the WebFOCUS step. Run the SQL pass-through step alone - you should still get the Oracle error.

SQL SQLORA
SELECT  TO_CHAR(T2.WK_BEG_D,'MM-DD-YYYY') WEEK_BEG_D, TO_CHAR(SYSDATE,'MM-DD-YYYY') CURR_DATE, T2.ACCT_MO_N
AS MONTH_NAME FROM ACCT T1, ACCT T2
WHERE  T2.ACCT_D = (T1.WK_BEG_D-1)
AND T1.ACCT_D = TO_CHAR(SYSDATE, 'DD-MON-YY' )
AND (ROWNUM < 10);
END

You are working with several dates, perhaps one of them does not contain the data or is not in the format you expect.

I would start by simplifying the SQL - remove the TO_CHAR functions, then start adding them one at a time until the error occurs.


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
Member
posted Hide Post
Thanks for the response.
GamP your solution worked!! I wasnt aware that READ -HOLD would create extra bytes while reading


LG


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 11 | Registered: November 17, 2010Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders