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.
I am looking for suggestions to convert this nested subquery to WF code. It generates a missing parentheses message in the SQL passthru wizard so that is out
I believe I am going to have to use hold files but am looking for some assistance as the SQL is above my level
Thanks
select 5 , 'Balance of New FY Pledges' row_name, 0, sum(greatest(0, agrpdes_amt - nvl((select nvl(sum(agrgdes_amt),0) from agrgdes, agbgift where agrgdes_pidm = agbpldg_pidm and agrgdes_pidm = agbgift_pidm and agrgdes_gift_no = agbgift_gift_no and agrgdes_pledge_no = agrpdes_pledge_no and agrgdes_campaign = agrpdes_campaign and agrgdes_desg = agrpdes_desg and TRUNC(agbgift_gift_date) <= '31-JAN-2015' ),0) - nvl((select nvl(sum(agrgmlt_3pp_amt),0) from agrgmlt, agbgift where agrgmlt_3pp_pledge_no = agrpdes_pledge_no and agrgmlt_pidm = agbgift_pidm and agrgmlt_gift_no=agbgift_gift_no and agrgmlt_campaign = agrpdes_campaign and agrgmlt_desg = agrpdes_desg and TRUNC(agbgift_gift_date) <='31-JAN-2015' ),0) - nvl((select nvl(sum(agrgmmo_3pp_amt),0) from agrgmmo, agbgift where agrgmmo_3pp_pledge_no = agrpdes_pledge_no and agrgmmo_pidm = agbgift_pidm and agrgmmo_gift_no = agbgift_gift_no and agrgmmo_campaign = agrpdes_campaign and agrgmmo_desg = agrpdes_desg and TRUNC(agbgift_gift_date) <= '31-JAN-2015' ),0)
)) from AGBPLDG, AGRPDES WHERE (AGBPLDG_PIDM = AGRPDES_PIDM) AND (AGBPLDG_PLEDGE_NO = AGRPDES_PLEDGE_NO) AND AGBPLDG_PLDG_CODE IN (SELECT ATVPLDG_CODE FROM ATVPLDG WHERE NVL(ATVPLDG_PLANNED_GIFT_IND,'0') <> '1' AND ATVPLDG_CODE NOT IN ('PO')) AND AGBPLDG_PSTA_CODE IN ('A','P') AND AGBPLDG_FISC_CODE = '2015' AND TRUNC(AGBPLDG_PLEDGE_DATE ) <= '31-JAN-2015' and agrpdes_desg not in [select adbdesg_desg from adbdesg where ADBDESG_DSTP_CODE = 'NG')
Oh and the SQL will work in TOAD and Oracle Developer , just not in WebFOCUSThis message has been edited. Last edited by: <Emily McAllister>,
SET ASNAMES=ON
SET EMPTYCELLS = OFF
SET NODATA = 0
SET HOLDLIST=PRINTONLY
-SET &ORA_CON = 'YOUR_DESIRED_CONNECTION_LISTED_AT_TNSNAMES.ORA';
-****************************************
-* SET SQLORA ENGINE TO RUN SQL QUERIES
-****************************************
ENGINE SQLORA SET DEFAULT_CONNECTION &ORA_CON
SQL SQLORA PREPARE QUERY1 FOR
select 5 , 'Balance of New FY Pledges' row_name, 0, sum(greatest(0, agrpdes_amt -
nvl((select nvl(sum(agrgdes_amt),0) from agrgdes, agbgift
where agrgdes_pidm = agbpldg_pidm and agrgdes_pidm = agbgift_pidm and agrgdes_gift_no = agbgift_gift_no
and agrgdes_pledge_no = agrpdes_pledge_no
and agrgdes_campaign = agrpdes_campaign
and agrgdes_desg = agrpdes_desg and TRUNC(agbgift_gift_date) <= '31-JAN-2015' ),0) -
nvl((select nvl(sum(agrgmlt_3pp_amt),0)
from agrgmlt, agbgift
where agrgmlt_3pp_pledge_no = agrpdes_pledge_no and agrgmlt_pidm = agbgift_pidm and agrgmlt_gift_no=agbgift_gift_no
and agrgmlt_campaign = agrpdes_campaign
and agrgmlt_desg = agrpdes_desg and TRUNC(agbgift_gift_date) <='31-JAN-2015' ),0) -
nvl((select nvl(sum(agrgmmo_3pp_amt),0)
from agrgmmo, agbgift
where agrgmmo_3pp_pledge_no = agrpdes_pledge_no and agrgmmo_pidm = agbgift_pidm and agrgmmo_gift_no = agbgift_gift_no
and agrgmmo_campaign = agrpdes_campaign
and agrgmmo_desg = agrpdes_desg and TRUNC(agbgift_gift_date) <= '31-JAN-2015' ),0)
))
from AGBPLDG, AGRPDES WHERE (AGBPLDG_PIDM = AGRPDES_PIDM) AND (AGBPLDG_PLEDGE_NO = AGRPDES_PLEDGE_NO) AND
AGBPLDG_PLDG_CODE IN (SELECT ATVPLDG_CODE FROM ATVPLDG WHERE NVL(ATVPLDG_PLANNED_GIFT_IND,'0') <> '1' AND ATVPLDG_CODE NOT IN ('PO'))
AND AGBPLDG_PSTA_CODE IN ('A','P') AND AGBPLDG_FISC_CODE = '2015' AND TRUNC(AGBPLDG_PLEDGE_DATE ) <= '31-JAN-2015' and agrpdes_desg not in [select adbdesg_desg from adbdesg where ADBDESG_DSTP_CODE = 'NG')
;
END
-RUN
TABLE FILE QUERY1
ENJOY
END
WebFOCUS 8.1.05 / APP Studio
Posts: 272 | Location: Brazil | Registered: October 31, 2006
SET ASNAMES=ON SET EMPTYCELLS = OFF SET NODATA = 0 SET HOLDLIST=PRINTONLY -SET &ORA_CON = 'YOUR_DESIRED_CONNECTION_LISTED_AT_TNSNAMES.ORA'; -**************************************** -* SET SQLORA ENGINE TO RUN SQL QUERIES -**************************************** ENGINE SQLORA SET DEFAULT_CONNECTION &ORA_CON SQL SQLORA PREPARE QUERY1 FOR select 5 , 'Balance of New FY Pledges' row_name, 0, sum(greatest(0, agrpdes_amt - nvl((select nvl(sum(agrgdes_amt),0) from agrgdes, agbgift where agrgdes_pidm = agbpldg_pidm and agrgdes_pidm = agbgift_pidm and agrgdes_gift_no = agbgift_gift_no and agrgdes_pledge_no = agrpdes_pledge_no and agrgdes_campaign = agrpdes_campaign and agrgdes_desg = agrpdes_desg and TRUNC(agbgift_gift_date) <= '31-JAN-2015' ),0) - nvl[[select nvl[sum[agrgmlt_3pp_amt),0) from agrgmlt, agbgift where agrgmlt_3pp_pledge_no = agrpdes_pledge_no and agrgmlt_pidm = agbgift_pidm and agrgmlt_gift_no=agbgift_gift_no and agrgmlt_campaign = agrpdes_campaign and agrgmlt_desg = agrpdes_desg and TRUNC[agbgift_gift_date) <='31-JAN-2015' ),0) - nvl[[select nvl[sum[agrgmmo_3pp_amt),0) from agrgmmo, agbgift where agrgmmo_3pp_pledge_no = agrpdes_pledge_no and agrgmmo_pidm = agbgift_pidm and agrgmmo_gift_no = agbgift_gift_no and agrgmmo_campaign = agrpdes_campaign and agrgmmo_desg = agrpdes_desg and TRUNC[agbgift_gift_date) <= '31-JAN-2015' ),0) )) from AGBPLDG, AGRPDES WHERE [AGBPLDG_PIDM = AGRPDES_PIDM) AND [AGBPLDG_PLEDGE_NO = AGRPDES_PLEDGE_NO) AND AGBPLDG_PLDG_CODE IN [SELECT ATVPLDG_CODE FROM ATVPLDG WHERE NVL[ATVPLDG_PLANNED_GIFT_IND,'0') <> '1' AND ATVPLDG_CODE NOT IN ('PO')) AND AGBPLDG_PSTA_CODE IN ('A','P') AND AGBPLDG_FISC_CODE = '2015' AND TRUNC(AGBPLDG_PLEDGE_DATE ) <= '31-JAN-2015' and agrpdes_desg not in [select adbdesg_desg from adbdesg where ADBDESG_DSTP_CODE = 'NG') ; END -RUN TABLE FILE QUERY1 ENJOY END
THROWS ERROR MESSAGE
(FOC1400) SQLCODE IS 907 (HEX: 0000038B) : ORA-00907: missing right parenthesis SAME AS WITH sql WIZARD AND I corrrected [ TO (
What i am really looking for is to break this into smaller components I believe as SQL wizrd is choking on all the nesting My preference would be to break
-* subselect 1 nvl((select nvl(sum(agrgdes_amt),0) from agrgdes, agbgift where agrgdes_pidm = agbpldg_pidm and agrgdes_pidm = agbgift_pidm and agrgdes_gift_no = agbgift_gift_no and agrgdes_pledge_no = agrpdes_pledge_no and agrgdes_campaign = agrpdes_campaign and agrgdes_desg = agrpdes_desg and TRUNC(agbgift_gift_date) <= '31-JAN-2015' ),0) -
-*subselect 2 nvl((select nvl(sum(agrgmlt_3pp_amt),0) from agrgmlt, agbgift where agrgmlt_3pp_pledge_no = agrpdes_pledge_no and agrgmlt_pidm = agbgift_pidm and agrgmlt_gift_no=agbgift_gift_no and agrgmlt_campaign = agrpdes_campaign and agrgmlt_desg = agrpdes_desg and TRUNC(agbgift_gift_date) <='31-JAN-2015' ),0) -
-* subselect 3 nvl((select nvl(sum(agrgmmo_3pp_amt),0) from agrgmmo, agbgift where agrgmmo_3pp_pledge_no = agrpdes_pledge_no and agrgmmo_pidm = agbgift_pidm and agrgmmo_gift_no = agbgift_gift_no and agrgmmo_campaign = agrpdes_campaign and agrgmmo_desg = agrpdes_desg and TRUNC(agbgift_gift_date) <= '31-JAN-2015' ),0)
into smaller pieces (HOLDS) preferably with WF code then join to parent
it will run from TOAD but not in SQL wizard. Im not the owner of the SQL and don't have access to SQL PLUS but I would certainly be willing to entertain any suggestions re: the SQL code as I am no SQL expert