Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Get multiple rows in Perl from Oracle

by kalyanrajsista (Scribe)
on Dec 24, 2009 at 12:25 UTC ( #814228=note: print w/replies, xml ) Need Help??


in reply to Re^3: Get multiple rows in Perl from Oracle
in thread Get multiple rows in Perl from Oracle

Here is my code

use strict; use warnings; use DBIx::Connection; use DBIx::PLSQLHandler; my $Datasource = "dbi:Oracle:sid=dev;host=10.11.12.13"; my $connection = DBIx::Connection->new( name => 'dev', dsn => $Datasource, username => 'scott', password => 'tiger', ); my $plsql = $connection->plsql_handler( plsql => "DECLARE TYPE group_type IS RECORD ( h1 groups.HANDLE_GROUP%TYPE, g1 groups.GHANDLE%type); group_rec group_type; CURSOR data_groups IS SELECT DISTINCT ghandle FROM groups; BEGIN OPEN data_groups; FETCH data_groups INTO group_rec.g1; WHILE data_groups % FOUND LOOP SELECT handle_group INTO group_rec.h1 FROM groups WHERE ghandle = group_rec.g1 AND rownum < 2; DBMS_OUTPUT.PUT_LINE(group_rec.g1 || '==>' + || group_rec.h1); :h2 :=group_rec.h1; :g2 :=group_rec.g1; FETCH data_groups INTO group_rec.g1; END LOOP; CLOSE data_groups; END;" ); my $result_set = $plsql->execute(); print Dumper($result_set);

The above code is returning only one record, but when I execute my procedure in SQL Developer it is outputting many records

Any problem in my procedure...though

Replies are listed 'Best First'.
Re^5: Get multiple rows in Perl from Oracle
by Corion (Pope) on Dec 24, 2009 at 13:17 UTC

    Usually when working with DBI and things interacting with it, the result from ->execute() only indicates success or failure. I presume you're supposed to ->fetch (or ->fetchall_arrayref) the results.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://814228]
help
Chatterbox?
[Eily]: can't the nodelet be moved though? Maybe you could put one that doesn't change first ("Sections" or "Find Nodes" for example)
[Eily]: "Other Users" seems like a poor choice :P
[Eily]: nope, Nodelet Settings doesn't let you move the XP Nodelet, CSS might
[marinersk]: That would mitigate the distraction/jangle issue, but then the information wouldn't be easy to find when it is populated. Plus, I don't currently see a way to move it, but I'm not done poking around on that point yet.
[marinersk]: Ah, you beat me to it.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-05-29 14:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?