RE: set serveroutput on

2004-08-03 Thread Fox, Michael

If you are trying to get output from a stored procedure, use something like:

#enable output
  $dbh->func( 100, 'dbms_output_enable' );
#execute proc $sp
  my $sth=$dbh->prepare($sp);
  $sth->execute();
#retrieve output
  my @text = $dbh->func( 'dbms_output_get' );

and @text contains what would have been printed in your SQLPLUS session with
"SET SERVEROUTPUT ON" 

perldoc DBD::Oracle for more details

-Original Message-
From: Michael A Chase [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 3 August 2004 10:58 PM
To: Tran, Dong D [IBM GS]; DBI-Users
Subject: Re: set serveroutput on


On 08/03/2004 12:56 AM, Tran, Dong D [IBM GS] said:

> Is it possible from me to have the example of "SET SERVEROUTPUT ON" in
Perl?

I am not the sole source of all wisdom.  Questions like this should be 
asked at [EMAIL PROTECTED], not directly to me.

If you are asking about DBI, the answer is no.  SET is not SQL, it is a 
SQL*Plus command.

-- 
Mac :})
** I usually forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Cthulhu in 2004.  Don't settle for the lesser evil.

Australia Post is committed to providing our customers with excellent service. If we 
can assist you in any way please telephone 13 13 18 or visit our website 
www.auspost.com.au.

CAUTION

This e-mail and any files transmitted with it are privileged and confidential 
information intended for the use of the addressee. The confidentiality and/or 
privilege in this e-mail is not waived, lost or destroyed if it has been transmitted 
to you in error. If you have received this e-mail in error you must (a) not 
disseminate, copy or take any action in reliance on it; (b) please notify Australia 
Post immediately by return e-mail to the sender; and (c) please delete the original 
e-mail.


Re: set serveroutput on

2004-08-03 Thread Ravi Kongara
There two ways to set SERVEROUTPUT ON in Perl.
1) Using HERE docs 
 ex: $sqlcmd="sqlplus -s $user/[EMAIL PROTECTED] << EOF > 
/dev/null\n ".
   "set echo off\n".
   "set verify off\n".
   "set feedback off\n".
   "set heading off\n".
   "set conca off\n".
   "set pagesize 0\n".
   "set newpage 0\n".
   "set serverout on\n".
"spool $out_file\n".
   "whenever sqlerror exit 1\n".
   "exec 
insLogMsgs_p($session,'MRS_EXCEPTIONS','$table_name',001,'error while 
retrieving exceptions from 
sa_log_mrs_exceptions','mrs_exceptions_cleanup.pl::$get_stmt')\n".
   "quit\n".
   "EOF\n";

2) By using Perl/DBI and setting database handler's attribute.
ex: $dbh->dbms_output.enable ( 10 );  ( Syntax may be wrong, pl 
check ).

regs
Ravi Kumar
Michael A Chase wrote:
On 08/03/2004 12:56 AM, Tran, Dong D [IBM GS] said:
Is it possible from me to have the example of "SET SERVEROUTPUT ON" 
in Perl?

I am not the sole source of all wisdom.  Questions like this should be 
asked at [EMAIL PROTECTED], not directly to me.

If you are asking about DBI, the answer is no.  SET is not SQL, it is 
a SQL*Plus command.




Re: set serveroutput on

2004-08-03 Thread Michael A Chase
On 08/03/2004 12:56 AM, Tran, Dong D [IBM GS] said:
Is it possible from me to have the example of "SET SERVEROUTPUT ON" in Perl?
I am not the sole source of all wisdom.  Questions like this should be 
asked at [EMAIL PROTECTED], not directly to me.

If you are asking about DBI, the answer is no.  SET is not SQL, it is a 
SQL*Plus command.

--
Mac :})
** I usually forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Cthulhu in 2004.  Don't settle for the lesser evil.


RE: SET SERVEROUTPUT ON

2001-02-20 Thread Loo, Peter # PHX



Hi all,
 
Just wanted to thank everyone who helped shed light for 
me.  It worked out great in my test program below so I will add it to my 
production program now.  Thanks a bunch.
 
#!/usr/bin/perl
 
  use DBI;
 
  $ENVR = cwd() =~ 
/devl/ ? "devl" : "prod";
 
  require 
"/usr/local/apps/sma/${ENVR}/bin/Local_Vars.pl" || die "$!\n";
 
  my $dbh = 
DBI->connect("dbi:Oracle:$INSTANCE","$DBUSER","$DBPASS", 
{    
PrintError => 1, RaiseError => 1 });
 
  $dbh->func(100, 
'dbms_output_enable');
 
  my $sth = 
$dbh->prepare("DECLARE tmp 
VARCHAR2(50);   
BEGIN 
SELECT SYSDATE INTO tmp FROM 
DUAL; 
DBMS_OUTPUT.PUT_LINE('The date is '|| 
tmp); 
DBMS_OUTPUT.PUT_LINE('This is the second 
line.'); 
DBMS_OUTPUT.PUT_LINE('This is the third 
line.'); 
DBMS_OUTPUT.PUT_LINE('This is the fourth 
line.');   
END;");
 
  
$sth->execute();
  $sth->finish;
 
  foreach ($dbh->func('dbms_output_get')) {    
print "$_\n";    }
 
  $dbh->disconnect();
 
  exit;
 
 
-Original Message-From: Loo, Peter # PHX 
[mailto:[EMAIL PROTECTED]]Sent: Tuesday, February 20, 2001 1:02 
PMTo: [EMAIL PROTECTED]Subject: SET SERVEROUTPUT 
ON
Hi 
All,
 
I want to 
set this environment on so that anything that the store procedure spits out will 
show during the debug process within Perl DBI connection.  Can someone 
please show me how I can set this?
 
  
$dbh->do("SET SERVEROUTPUT ON");
 
Not 
working.  Please help.
 
Peter


RE: SET SERVEROUTPUT ON

2001-02-20 Thread Mitchell, Louise M



It's 
this:
 
$dbh->func(dbms_output_enable);
 
Regards,
L

  -Original Message-From: Loo, Peter # PHX 
  [mailto:[EMAIL PROTECTED]]Sent: Tuesday, February 20, 2001 
  12:02 PMTo: [EMAIL PROTECTED]Subject: SET SERVEROUTPUT 
  ON
  Hi 
  All,
   
  I want to 
  set this environment on so that anything that the store procedure spits out 
  will show during the debug process within Perl DBI connection.  Can 
  someone please show me how I can set this?
   
    
  $dbh->do("SET SERVEROUTPUT ON");
   
  Not 
  working.  Please help.
   
  Peter


Re: SET SERVEROUTPUT ON

2001-02-20 Thread Michael A. Chase

'SET SERVEROUTPUT ON' is a SQL*Plus command to enable DBMS_OUTPUT buffering.
To do the same thing under DBI/DBD::Oracle, use the DBI func() method.  Run
'perldoc DBD::Oracle' and read the section that starts with
'dbms_output_enable / dbms_output_put / dbms_output_get' for calling syntax
and examples.

Note that DBMS_OUTPUT text is _not_ available while the procedure is
running, only on exit from the procedure.  If you need real-time output, use
packages FND_FILE or DBMS_PIPE.  If you use the later, I have a Perl
receiver script you can use.

--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
- Original Message -
From: "Loo, Peter # PHX" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 20, 2001 12:01 PM
Subject: SET SERVEROUTPUT ON


> I want to set this environment on so that anything that the store
procedure
> spits out will show during the debug process within Perl DBI connection.
> Can someone please show me how I can set this?
>
>   $dbh->do("SET SERVEROUTPUT ON");
>
> Not working.  Please help.





SET SERVEROUTPUT ON

2001-02-20 Thread Loo, Peter # PHX



Hi 
All,
 
I want to 
set this environment on so that anything that the store procedure spits out will 
show during the debug process within Perl DBI connection.  Can someone 
please show me how I can set this?
 
  
$dbh->do("SET SERVEROUTPUT ON");
 
Not 
working.  Please help.
 
Peter