Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] How to use Oracle bind variables in a SQL report
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] How to use Oracle bind variables in a SQL report
 Login/Join
 
Silver Member
posted
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
 
Posts: 40 | Registered: January 31, 2008Reply With QuoteReport This Post
Guru
posted Hide Post
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
 
Posts: 487 | Location: Toronto | Registered: June 23, 2009Reply With QuoteReport This Post
Silver Member
posted Hide Post
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
 
Posts: 40 | Registered: January 31, 2008Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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
 
Posts: 1594 | Location: Customer Support | Registered: April 12, 2005Reply With QuoteReport This Post
Silver Member
posted Hide Post
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
 
Posts: 40 | Registered: January 31, 2008Reply With QuoteReport This Post
Silver Member
posted Hide Post
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
 
Posts: 40 | Registered: January 31, 2008Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] How to use Oracle bind variables in a SQL report

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.