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     [SOLVED] How to Transfer Variable Value into Native SQL

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How to Transfer Variable Value into Native SQL
 Login/Join
 
Member
posted
Hi,

I have MRE report with one web page to call a Fex procedure.
The web page will transfer user selected date into the fex procedure.

Fex code: (simplfied example)
=======================
SET SQLENGINE=SQLORA
SQL SET SERVER databaseserver
SQL
select * from employ_table
where hire_date = &p_date
;
TABLE ON TABLE HOLD AS SQLtemp
END
-RUN
-*

=======================

Athough WebFOCUS tansfered the &p_date into the fex code,
But this variable is not replaced with its value in SQL part.

Would anyone tell me a way to let the &p_date variable to be replaced with its value before the SQL query is sent to Database?

We need to use SQL pass through, becasue the real SQL query and datamodel is very complicate.


Thanks,
William Zhu

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


webfocus 5.3
WebFOCUS 7.1.x
WebFOCUS 7.6.x
WebFOCUS 7.7.x
Unix
Excel / HTML / PDF
 
Posts: 17 | Registered: February 06, 2009Report This Post
Member
posted Hide Post
Sorry for the above question. It's not an issue.

Actually, the code works.

WebFCOUS will replace the variable with its value in SQL query part.

Thanks,


webfocus 5.3
WebFOCUS 7.1.x
WebFOCUS 7.6.x
WebFOCUS 7.7.x
Unix
Excel / HTML / PDF
 
Posts: 17 | Registered: February 06, 2009Report This Post
Master
posted Hide Post
William,

It really depends on what the default display of a date is. In our database (Oracle), the default display is mmm-dd-yyyy (i.e. JAN-01-2009). So we have to use the Oracle TO_DATE function as in:
WHERE HIRE_DATE = TO_DATE(&P_DATE,'YYYYMMDD')

You also have to be sure that the field contains just a date, that is, the time portion is set to midnight, otherwise, you will get just those records where the time portion is midnight. This is why we use the following:
-SET &BEGDT=20080317;
-SET &ENDDT=AYMD(&BEGDT,1,'I8YYMD');
.
.
WHERE HIRE_DATE >= TO_DATE(&BEGDT,'YYYYMMDD')
  AND HIRE_DATE <  TO_DATE(&ENDDT,'YYYYMMDD')
.
.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report 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     [SOLVED] How to Transfer Variable Value into Native SQL

Copyright © 1996-2020 Information Builders