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     [CLOSED] how to comment out line(s) in SQL ?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] how to comment out line(s) in SQL ?
 Login/Join
 
Master
posted
I have a sql script here and I am looking for a little help with rudimentary SQL editing stuff


ENGINE SQLORA SET DEFAULT CONNECTION DataPigsnslop
SQL SQLORA PREPARE SQLOUT FOR

SELECT
APP1.DATE,
APP1.SEQ_NO,
APP1.SEQ_NAME,
ANGELS.AGNT_BANK_NO,
ANGELS.AGNT_BANK_NME,
ANGELS.ASSOCN_NUM,
ANGELS.ASSOCN_NME

CASE WHEN CALC_PAYROLL.N_PUZZLE IN (‘ABC’,’DEF’,GHI,LMN,)
Then (X_PAY_ITEM * X_PAYT_FUND) else 0
END as GROUP_COST_FULL,
Etc.
CALC_AGGR_FNL_D_PAY_RT_ITEM,
FROM
DM.DM_EPPE_BILLG_RES_NPC_FNL_F CALC_RES_FNL
LEFT JOIN
DM.DM_EPPE_BILLG_RES_NPC_AGGR_F CALC_AGGR_FNL ON CALC_RES_FNL.I_RES_FNL_ID = CALC_AGGR_FNL.I_RES_FNL_ID
LEFT JOIN
DM.DM_EPPE_TMD_PRTNR_DEMO PTNR_DEMO_FNL ON CALC_RES_FNL.I_PTNR_ID = PTNR_DEMO_FNL.PTNR_ID
LEFT JOIN
DM.DM_EPPE_INBND_MRCHNTATTR_NPC INBND_MRCHNT_ATTR_NPC ON CALC_RES_FNL.I_LCL_ENTY = INBND_MRCHNT_ATTR_NPC.MRCHNT_NBR
LEFT JOIN
DM.DM_EPPE_MRCHNT_GRP_ASSOCN_FNL MRCHNT_GRP_ASSOCN_FNL ON CALC_RES_FNL.I_LCL_ENTY = MRCHNT_GRP_ASSOCN_FNL.MRCHNT_ID
LEFT JOIN
DM.DM_EPPE_MRCHNT_ATRB_FNL MRCHNT_ATTR_FNL ON CALC_RES_FNL.I_LCL_ENTY = MRCHNT_ATTR_FNL.MRCHNT_ID
LEFT JOIN
DM.DM_EPPE_RPT_PTNR_STMT_XREF PTNR_STMT_XREF ON CALC_RES_FNL.C_RES_CODE = PTNR_STMT_XREF.LKPUP_CDE
LEFT JOIN
DM.DM_EPPE_BILLG_PTNR_SRVC_FNL PRD_FNL ON CALC_RES_FNL.C_RES_CODE = PRD_FNL.PRODUCT
;
END
-RUN

While working with SQL passthru in WebFOCUS it seems like I'm working in a world (SQL) within another world (WebFOCUS) regarding things
like the proper syntax for commenting a single line or commenting out multiple lines.

Can anyone pass the wisdom?

1. How to comment a single line of SQL code, is it /* or is it -* as in WebFOCUS?
2. In WebFOCUS, I know to place the
'IF RECORDLIMIT EQ 5' before the END statement in a focexec.
Can I see an example of the LIMIT 5 used in SQL passthru?

Thank you.
Tom

This message has been edited. Last edited by: FP Mod Chuck,


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report This Post
Silver Member
posted Hide Post
Hi Tom,

If I recall correctly the /* */ will work, the SQL style double dashes -- will not and throw an error. I don't remember if the WF style comments throw an error, possible if it's contained within the portion you're sending to the Oracle Db.

I see you're using the Oracle adapter, so you'd have to use the Oracle method for limit, like
SELECT *
FROM (your table)
WHERE ROWNUM <= 5
ORDER BY column


WF Version 8105
 
Posts: 45 | Registered: October 07, 2015Report This Post
Platinum Member
posted Hide Post
I have used the WebFocus -* to comment out a single SQL line when I do SQL Passthru. I'm using SQL Server, so I don't know if that makes a difference.

--Deb


WebFOCUS 8.2.03 (production), 8.2.06 (testing)
AppStudio, InfoAssist
Windows, All Outputs
 
Posts: 183 | Location: Indiana | Registered: December 05, 2017Report This Post
Master
posted Hide Post
Using a SQL Passthru in a fex I have found it's better to use the WebFOCUS comment -* . WebFOCUS just ignores that line of code and it doesn't get passed. If using an external SQL file you should use the SQL specific comment for the engine that you are using.

To limit the records you can always just use the focus command. The SQL Passthru basically builds a temporary view and no query is run nor data is passed until you request the data.
  
ENGINE SQLORA SET DEFAULT CONNECTION DataPigsnslop
SQL SQLORA PREPARE SQLOUT FOR

SELECT
APP1.DATE,
APP1.SEQ_NO,
APP1.SEQ_NAME,
ANGELS.AGNT_BANK_NO,
ANGELS.AGNT_BANK_NME,
ANGELS.ASSOCN_NUM,
ANGELS.ASSOCN_NME

CASE WHEN CALC_PAYROLL.N_PUZZLE IN (‘ABC’,’DEF’,GHI,LMN,)
Then (X_PAY_ITEM * X_PAYT_FUND) else 0
END as GROUP_COST_FULL,
Etc.
CALC_AGGR_FNL_D_PAY_RT_ITEM,
FROM
DM.DM_EPPE_BILLG_RES_NPC_FNL_F CALC_RES_FNL
LEFT JOIN
DM.DM_EPPE_BILLG_RES_NPC_AGGR_F CALC_AGGR_FNL ON CALC_RES_FNL.I_RES_FNL_ID = CALC_AGGR_FNL.I_RES_FNL_ID
LEFT JOIN
DM.DM_EPPE_TMD_PRTNR_DEMO PTNR_DEMO_FNL ON CALC_RES_FNL.I_PTNR_ID = PTNR_DEMO_FNL.PTNR_ID
LEFT JOIN
DM.DM_EPPE_INBND_MRCHNTATTR_NPC INBND_MRCHNT_ATTR_NPC ON CALC_RES_FNL.I_LCL_ENTY = INBND_MRCHNT_ATTR_NPC.MRCHNT_NBR
LEFT JOIN
DM.DM_EPPE_MRCHNT_GRP_ASSOCN_FNL MRCHNT_GRP_ASSOCN_FNL ON CALC_RES_FNL.I_LCL_ENTY = MRCHNT_GRP_ASSOCN_FNL.MRCHNT_ID
LEFT JOIN
DM.DM_EPPE_MRCHNT_ATRB_FNL MRCHNT_ATTR_FNL ON CALC_RES_FNL.I_LCL_ENTY = MRCHNT_ATTR_FNL.MRCHNT_ID
LEFT JOIN
DM.DM_EPPE_RPT_PTNR_STMT_XREF PTNR_STMT_XREF ON CALC_RES_FNL.C_RES_CODE = PTNR_STMT_XREF.LKPUP_CDE
LEFT JOIN
DM.DM_EPPE_BILLG_PTNR_SRVC_FNL PRD_FNL ON CALC_RES_FNL.C_RES_CODE = PRD_FNL.PRODUCT
;
END

TABLE FILE SQLOUT
PRINT *
WHERE RECORDLIMIT EQ 10
END
-RUN


    


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Master
posted Hide Post
Can i put 2 Where statements in the script like this, just after the JOINS ?

..... LEFT JOIN....
Where rownum < = 5
Where PRD_FNL.DIV=‘NPC’
;
END


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report This Post
Silver Member
posted Hide Post
Hey Tom, for SQL you'd only need one WHERE then combine the criteria with AND/OR, so for your example:

WHERE PRD_FNL.DIV = 'NPC' AND
ROWNUM <= 5;

I'm a little curious for the need of a limit, are you testing a small sample of records coming in, or do you need something like the Top 5 or most Recent 5 transactions?

While it's an older article, this is a pretty good write-up on ROWNUM for Oracle https://blogs.oracle.com/oracl...and-limiting-results


WF Version 8105
 
Posts: 45 | Registered: October 07, 2015Report This Post
Master
posted Hide Post
As this data store is large, we want to capture a limited sample (5 recs) from a specific business division.

Thank you


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 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     [CLOSED] how to comment out line(s) in SQL ?

Copyright © 1996-2020 Information Builders