Focal Point
[CLOSED] How to use Oracle bind variables in a SQL report

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

June 21, 2017, 03:47 PM
TechLights
[CLOSED] How to use Oracle bind variables in a SQL report
Hi all, we would like using Oracle bind variables in some of our reports and need your help for that.

We found the following example creates an Oracle table from the CAR file, then issues a PREPARE followed by queries that pass two parameters, it works pretty well.
--------------------
TABLE FILE CAR
PRINT SEATS
BY COUNTRY
BY CAR
ON TABLE HOLD AS BAUCAR FORMAT SQLORA
END

SQL SQLORA BEGIN SESSION

SQL SQLORA PREPARE ABC FOR SELECT * FROM BAUCAR WHERE COUNTRY=:0001 AND
SEAT=:0002;
END

SQL SQLORA BIND ABC USING CHAR(10), DECIMAL(4);
END

-* repeat with different input data...

SQL SQLORA EXECUTE ABC USING 'ENGLAND',2 ; TABLE FILE ABC PRINT *
END

SQL SQLORA EXECUTE ABC USING 'FRANCE',5 ; TABLE FILE ABC PRINT *
END

SQL SQLORA EXECUTE ABC USING 'ITALY',4 ; TABLE FILE ABC PRINT *
END

SQL SQLORA EXECUTE ABC USING 'JAPAN',4; TABLE FILE ABC PRINT *
END
----------------------

*But the difference is that our reports are SQL reports (Type SQL statements in the report request). I failed to use Oracle bind variables based on the example above.
*Could you please provide a correct example or tell me where is wrong in the following code, appreciate!

------------------
ENGINE SQLORA SET DEFAULT_CONNECTION &DEFCONN
SQL SQLORA PREPARE SQLOUT FOR
---SQL here----
END

TABLE FILE SQLOUT
PRINT
QUESTION
IS_ACTIVE
REVISION
COMMENTS
BY QUESTION_ID
ON TABLE HOLD AS HOLD_IT FORMAT SQLORA
END

SQL SQLORA BEGIN SESSION

SQL SQLORA PREPARE ABC FOR SELECT * FROM HOLD_IT WHERE QUESTION=:0001 AND REVISION=:0002;
END

SQL SQLORA BIND ABC USING VARCHAR2(300), NUMBER(38);
END

SQL SQLORA EXECUTE ABC USING 'I05479',1 ; TABLE FILE ABC PRINT *
END
---------------------

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


7703 on Linux, Windows
ReportCaster
PDF, HTML, Excel, AHTML, and CSV
June 22, 2017, 01:04 PM
Tamra
quote:
Oracle bind variables


The following link is similar to the example you provided above.

How to use Oracle bind variables in a query

Did you review the document that is referred to at the end of the example?

This is further documented in the Relational Data Adapter User's Manual:

Are you still using WebFOCUS 7.1.7 ??? Please update your profile if not.

Thank you for participating in the Focal Point Forum!
Tamra Colangelo
Focal Point Moderator
Information Builders


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
June 22, 2017, 06:24 PM
TechLights
Thanks Tamra! I updated my profile.

I read Relational Data Adapter User’s Manual, but it is not helping me on how to use Oracle Bind Variables.
Also we are directly connecting to remote DB Server rather than using Adapter.

Does anyone have ideas to use Oracle Bind Variables in a SQL report? Thanks for help.


7703 on Linux, Windows
ReportCaster
PDF, HTML, Excel, AHTML, and CSV
June 26, 2017, 02:15 PM
FP Mod Chuck
Hi TechLights

I found this old FP post that may help. http://forums.informationbuild...1057331/m/8047044766

If not you should probably open a case with techsupport and hopefully they can assist you with this.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 27, 2017, 02:05 PM
TechLights
Hi Chuck,
Good suggestion. We will open a case with tech-support. Thanks!

By the way, we found this old FP post too.


7703 on Linux, Windows
ReportCaster
PDF, HTML, Excel, AHTML, and CSV
July 13, 2017, 02:24 PM
TechLights
I have got help from tech-support. I am in the progress to change a SQL report to use bind variables.

I met a difficulty in dealing with a calendar’ value that needs your help:

When client picks a date from calendar, the value will pass into the report as a string (mm/dd/yyyy), it is easy to use to_date() function to convert this string into date (mm/dd/yyyy) in the sql.

After use bind variables, this string must be converted before pass it into the sql. Any idea how to do this?

Thanks for help!


7703 on Linux, Windows
ReportCaster
PDF, HTML, Excel, AHTML, and CSV