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: "Kanchana Weerasinghe" <kanchana at artisannetwork dot com>
Subject: DBLib dbrpcinit Question
Date: Aug 30 2001 9:48PM

Could anyone tell me how to specify NUMERIC and INT datatypes in a rpc call
...similar to the CHAR call in the example below:

#!/usr/local/bin/perl
#
# @(#)rpc-example.pl    1.2 9/19/95
#
# THis is an example of dbrpc*() calls usage in sybperl.
#
# It is based on a stored proc that we use at ITF to compute the
# unrealised value of a futures trading account. THe stored proc gets
# the account number and the date as input, and outputs the value in two
# MONEY parameters (one in US$, the other in the reference curreny of
# the account).
#
# Proc usage:
#
# exec compute_open_val @account, @date, @val1 out, @val2 out

use Sybase::DBlib;

$d = new Sybase::DBlib;

$d->dbrpcinit("t_proc", 0) || die "rpcinit failed";
$acc = 'CIS 98941';
$d->dbrpcparam("\@account", 0, SYBCHAR, -1, length($acc), $acc) ||
    die "rpcparam ($acc) failed";
$date = '950529';
$d->dbrpcparam("\@date", 0, SYBCHAR, -1, length($date), $date) ||
    die "rpcparam ($date) failed";
$d->dbrpcparam("\@open_val", DBRPCRETURN, SYBFLT8, -1, -1, 0) ||
    die "rpcparam (\@open_val) failed";
$d->dbrpcparam("\@open_val_t", DBRPCRETURN, SYBFLT8, -1, -1, 0) ||
    die "rpcparam (\@open_val_t) failed";
$d->dbrpcsend || die "rpcsend failed";
while($d->dbresults != NO_MORE_RESULTS)
{
    while(@dat = $d->dbnextrow)
    {
        print "@dat\n";
    }
}
if($d->dbhasretstat)
{
    print "Return status: ", $d->dbretstatus, "\n";
}
%ret = $d->dbretdata(1);
foreach (keys(%ret))
{
    print "$_: $ret{$_}\n";
}