in reply to Template::Toolkit - How do i access alias-based results?

What kind of datastructure does oracleDB->execute() return?

I would assume that you don't need the u. prefix.

Replies are listed 'Best First'.
Re^2: Template::Toolkit - How do i access alias-based results?
by Yaerox (Scribe) on Jul 13, 2015 at 12:50 UTC
    Using Perl - CGI I'd do it like this:
    $hDB = _OracleConnect(); $hStatement = $hDB->prepare("MY SQL"); $hStatement->execute( $var1, $var2, $var3 ); while ( ( $ret1, $ret2, $ret3 ) = $hStatement->fetchrow_array ){ # do stuff } $hStatement->finish; $hDB->disconnect;
    Or do you want me to data dump? If yes, in Template Toolkit, or just by using Perl CGI? Because I won't know how to dump this helpful in Template Toolkit.

    Leaving the u prefix on the printings doesn't make a difference. I already tried this, just saying % user.name % but still empty.

      Yes, printing a Dumper output of the data structure you create in # do stuff or even better, the data structure that you give to Template::Toolkit would help to find out what you need to do to access the elements of the data structure.

        # DB - Connect my $hDB = DBI->connect( "dbi:Oracle:dbname", "dbusername", "dbuserpass +wort", { AutoCommit => 0 } ); my $hStatement = $hDB->prepare("MY SQL HERE"); $hStatement->execute( ); while ( ( $var1, $var2, $var3) = $hStatement->fetchrow_array ){ push( @aRows, ( $var1, $var2, $var3 ) ); } $hStatement->finish; $hDB->disconnect; print Dumper( @aRows );
        output
        $VAR1 = '11000530'; $VAR2 = '8041094A'; $VAR3 = 'Eingelesen'; $VAR4 = +'09-JUL-15'; $VAR5 = '528';
        Imo this shouldn't be interesting at all. The question is, how to access resultset when using joings on TT ...