Focal Point
[SOLVED] SQL Passthru

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/798108722

September 02, 2009, 12:19 PM
DLR
[SOLVED] SQL Passthru
I am trying to use a SQL passthru in my webfocus report . It seems that the SQL statement is working because it displays the results in my output but does not go on with the rest of the code to create the report.

Could some please help me with this problem. I'm wanting to put the results in a hold file to be used in my report.

Thanks!!!!!

.
.
.
SQL
SELECT
NBRJOBS_PIDM,
NBRJOBS_POSN,
NBRJOBS_SUFF,
NBRJOBS_STATUS,
NBRJOBS_ECLS_CODE,
NBRJOBS_REG_RATE,
NBRJOBS_PER_PAY_SALARY,
NBRJOBS_EFFECTIVE_DATE
FROM NBRBJOB, NBRJOBS X
WHERE NBRBJOB_PIDM = NBRJOBS_PIDM
AND NBRBJOB_POSN = NBRJOBS_POSN
AND NBRBJOB_SUFF = NBRJOBS_SUFF
AND NBRJOBS_ECLS_CODE IN ('40','42');
AND (nbrjobs_status IN ('A','L','B','F','P')
OR (nbrjobs_status IN ('T','I')
AND nbrjobs_effective_date BETWEEN TO_DATE(TO_NUMBER(
&PAYROLLBEGIN),'J')
AND TO_DATE(TO_NUMBER(&PAYROLLEND),'J')))
AND nbrbjob_begin_date <= TO_DATE[TO_NUMBER[&PAYROLLEND),'J')
AND (nbrbjob_end_date >= TO_DATE(TO_NUMBER(&PAYROLLBEGIN),'J')
OR nbrbjob_end_date IS NULL)
AND (nbrjobs_effective_date =
(SELECT MAX(nbrjobs_effective_date)
FROM nbrjobs
WHERE nbrjobs_pidm = X.nbrjobs_pidm
AND nbrjobs_posn = X.nbrjobs_posn
AND nbrjobs_suff = X.nbrjobs_suff
AND nbrjobs_effective_date <= TO_DATE[TO_NUMBER[&PAYROLLBEGIN),'J'))
OR (nbrjobs_effective_date > TO_DATE(TO_NUMBER(&PAYROLLBEGIN),'J'
)
AND nbrjobs_effective_date <= TO_DATE[TO_NUMBER[&PAYROLLEND),'J') ) );

TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS EFFJOBS1
END

TABLE FILE EFFJOBS1
PRINT
NBRJOBS_PIDM.........

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


WF 8.1.04
September 02, 2009, 12:51 PM
Darin Lee
Unless you use SQL sqlenginename, (like SQL SQLMSS or SQL SQLDB2) it is not doing SQL passthru. It is just processing an SQL statement against the FOCUS Master files.

At the end of your SQL try

TABLE ON TABLE HOLD AS EFFJOBS1
END

TABLE FILE EFFJOBS1
PRINT
NBRJOBS_PIDM........


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
September 03, 2009, 09:07 AM
DLR
Darin, that didn't work either. Any other suggestions?


WF 8.1.04
September 03, 2009, 09:42 AM
Francis Mariani
Here's a valid SQL passthru statement. Does yours look like this?

SQL DB2
SELECT 
MIN(BASEL.TIME_D.TIME_DIM_KEY) AS TIME_DIM_KEY,
BASEL.TIME_D.CALENDAR_YEAR,
COUNT(*) AS COUNT
FROM BASEL.TIME_D
GROUP BY BASEL.TIME_D.CALENDAR_YEAR
ORDER BY BASEL.TIME_D.CALENDAR_YEAR
;
TABLE ON TABLE HOLD AS H001
END

TABLE FILE H001
PRINT TIME_DIM_KEY
BY CALENDAR_YEAR PAGE-BREAK
HEADING
"COUNT: <COUNT"
END

You need the SQL ENGINE statement before the SQL SELECT statement or specify the type of DBMS in the SQL SELECT statement (SQL DB2 SELECT...).


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
September 03, 2009, 03:14 PM
DLR
I figured it out. I had a ; out of place.

Thanks for you help!!!


WF 8.1.04