Passing parameters to Oracle report

From: Bruce C. Wright <bruce_at_ais.com>
Date: 26 Feb 93 12:55:32 GMT
Message-ID: <1993Feb26.125532.6048_at_ais.com>


In article <5B8JZB1w165w_at_vicuna.ocunix.on.ca>, frampton_at_vicuna.ocunix.on.ca (Steve Frampton) writes:
> Hi all:
>
>Is there a way to "push" the value onto SYS$INPUT or something like that?
>I haven't had much luck with the $DECK ... $EOD commands but maybe I'm
>using them wrong.
>
>Here's a code snippet from the .COM file:
>
>$ write sys$output "Parm P1 (pay period end date) = "+P1
>$ rpt myreport.rpt myreport.rpf 'oracle_password'
>$ ''P1'
>$! Rest of code follows...
>$ exit

I don't know exactly how Oracle reads these parameters. If it doesn't go through SYS$INPUT (for example, if it finds the current terminal name and read/writes directly to that), then you are in a bit of trouble; the only way to do that would be to write a program that ran Oracle on a pseudo-terminal and fed it the appropriate input at the appropriate places. Most programs that work that way will work fine over pseudoterminals,  but there are possibilities of incompatibility even there (some see the name of the pseudo-terminal device and conclude that they can't run on that type of device :-( ).

If you are just trying to put in a stock answer, the simplest way to do this is:

	$ rpt myreport.rpt myreport.rpf 'oracle_password'
	input-string
	$! Rest of code follows...
	$ exit

(assuming p1 is always equal to "input-string"). The problem happens if you want p1 to have different values at different times - then there is no way to have the substitution within the command file like this. The way around it is:

	$ open /write oracle_file sys$login:oracle_input.tmp
	$ write oracle_file p1
	$ close oracle_file
	$ assign /user sys$login:oracle_input.tmp sys$input
	$ rpt myreport.rpt myreport.rpf 'oracle_password'
	$! Rest of code follows...
	$ exit

Again, this only works if Oracle is reading its input from sys$input; this is often not the case for `full-screen' programs. It's sort of ugly but it works. Received on Fri Feb 26 1993 - 13:55:32 CET

Original text of this message