PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Redway, Michele" <mredway at lehman dot com>
Subject: RE: Question about retrieving "output" procedure parameters
Date: Jan 18 2001 11:22PM

Thanks,  Michael.  I used sql, similar to that  shown below:

	$sql = "declare \@param1 varchar, @\param2 varchar
	exec foo_proc \@param1  OUTPUT, \@param2 OUTPUT
	";

	When (as you suggested) I changed the execution of the proc to 
	==========
	exec foo_proc \@param1 = \@param1 OUTPUT, \@param2 = \@param2 OUTPUT
	============

	 the hash keys returned were  "@param1" and "@param2", which is
fine.
 
Michele Redway
mredway@lehman.com  


	-----Original Message-----
	From:	Michael Peppler [SMTP:mpeppler@peppler.org]
	Sent:	Thursday, January 18, 2001 4:10 PM
	To:	SybPerl Discussion List
	Subject:	Re: Question about retrieving "output" procedure
parameters

	Redway, Michele writes:
	 > Hi, there... the documentation states the following:
	 > 
	 > =================
	 > @dat = $dbh->dbretdata[$doAssoc])
	 > 
	 >      Retrieve the value of the parameters marked as 'OUTPUT' in a
stored
	 > procedure. If $doAssoc is non-0, then retrieve the data as an
associative
	 > array with parameter name/value pairs. 
	 > =================
	 > 
	 > It works fine, but the names of the parameters are not returned
when
	 > $doAssoc is 1. Instead, I get "Par 1" and Par 2".
	 > 
	 > Perhaps I'm doing something wrong...?

	Whether the parameter names are available when you fetch the OUTPUT
	data with dbretdata() depends on how the proc was called.

	If you use the dbrpcinit()/dbrpcparam() API calls to set up the
stored
	proc call you will get the parameter names, and if you use the
	language calls and define the names before hand like so you should
	also get the names:

	$sql = "declare \@param1 varchar
	exec foo_proc \@param1 = \@param1 OUTPUT
	";
	$dbh->dbcmd($sql);
	etc.

	At least I think so.

	In any case I only return whatever Sybase sends back (at least I
think
	so - I haven't looked at that part of the code in a *long* time :-)

	Michael
	-- 
	Michael Peppler - Data Migrations Inc. - mpeppler@peppler.org
	http://www.mbay.net/~mpeppler - mpeppler@mbay.net
	International Sybase User Group - http://www.isug.com
	Sybase on Linux mailing list: ase-linux-list@isug.com