Re: bind variable problem



Your first pattern is correct. In the second one you cannot use bind in an
in statment like this as it connot correctly quote the params. Not sure if
this is an DBI thing or DBD::Orale OCI thing though


"Anand . K . S ." <ks.anand80@xxxxxxxxx> wrote in message
news:9b02676d0701221656p52e2829fpce30cc0757b950e6@xxxxxxxxxxxxxxxxx
Hi,



This problem has been killing me for a while ?

Script 1 and script 2 (mentioned below) are very much the same. However I
have hard coded the query

in script 2 whereas constructed in script 1.



Also script 1 is implement on an environment (which uses oracle
version 9and DBI
1.38) and script 2 on another environment (which uses oracle version 10gand
)



In script 1, the sql query is executed successfully, but in script 2 it
fails in execute() step..

The bind variable has the following values:



Tables => CHARGE NORMALISED_EVENT SUBTOTAL_RATING_VALUE
SUBTOTAL_RATING_DELTA NORMALISED_EVENT_ERROR



Hard coding bind variables goes trhough fine.. Is this a known bug or am I
doing anything silly here.. Please could someone help me out?





Script 1:

========

$lsql = "SELECT NVL2(partition_name,

segment_name || ':' || partition_name,

segment_name)

FROM user_segments

WHERE segment_type IN ('TABLE', 'TABLE PARTITION') AND

segment_name NOT IN (";

}

# Create the necessary number of bind variable placeholders.

$lsql .= '?,' x scalar(@ltables);

# Remove the last ",".

chop $lsql;

# Order by BYTES if we are not splitting customer partitions out.

$lsql .= ") ORDER BY bytes DESC";

}



print ("\n SQL => $lsql");

# Execute the query and build an array of "other" table names.

my @lotherTables;

$lcsr = $zdb->prepare($lsql) ||

zDie("Could not prepare query at line " . __LINE__ . ": " .

$zdb->errstr);

$lcsr->execute(@ltables) ||

zDie("Could not execute query at line " . __LINE__ . ": " .

$zdb->errstr);





Script 2

=======

$lsql = "SELECT NVL2(partition_name,

segment_name || ':' || partition_name,

segment_name)

FROM user_segments

WHERE segment_type IN ('TABLE', 'TABLE PARTITION') AND

segment_name NOT IN

(SELECT object_name

FROM recyclebin bin) AND

segment_name NOT IN (?,?,?,?,?) ORDER BY bytes
DESC";#'CHARGE','NORMALISED_EVENT','SUBTOTAL_RATING_DELTA',

#'NORMALISED_EVENT_ERROR')
ORDER BY bytes DESC";

# Create the necessary number of bind variable placeholders.

#$lsql .= '?,' x scalar(@ltables);

# Remove the last ",".

#chop $lsql;

# Order by BYTES if we are not splitting customer partitions out.

#if (!$opt_scp) {

# $lsql .= ") ORDER BY bytes DESC";

#}

#else {

# $lsql .= ")";

#}

print ("\n sql => $lsql");

# Execute the query and build an array of "other" table names.

my @lotherTables;

$lcsr = $zdb->prepare($lsql) ||

zDie("Could not prepare query at line " . __LINE__ . ": " .

$zdb->errstr);

print ("\nTables => @ltables\n");

$lcsr->execute(@ltables) ||

zDie("Could not execute query at line " . __LINE__ . ": " .

$zdb->errstr);


Thanks,

Anand.


.



Relevant Pages

  • Re: error checking
    ... Using "On Error Resume Next" throughout a script masks all errors, ... each computer (no need to repeat the bind operation). ... ' Add the domain user to the local group. ... If the user object does not ...
    (microsoft.public.windows.server.scripting)
  • Re: Moving user to another container
    ... The main thing is you need to bind to the user object, objUser. ... I guess I do need your script because I still want to use the csv file. ... ' Use the Set method to specify the RPC 1779 format of the domain name. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Verify existence of computer object
    ... Directory computer object prior to its re-imaging. ... The script works fine. ... If this bind fails, the user ... On Error GoTo 0 ...
    (microsoft.public.scripting.vbscript)
  • Re: /var/named Changes Ownership to Root on Boot
    ... I find that bind isn't running. ... hard-coded a 4-line script that just starts bind no matter what. ... after a reboot so I am asking for an explanation of what I have ...
    (freebsd-questions)
  • man page syntax for +script
    ... The man pages for [bind] and [comm hook] both describe how you can either replace the current script or append to it, but they give slightly different syntaxes. ... I'd successfully appended scripts before, but yesterday I was trying to append a and getting the syntax wrong because of the man page. ...
    (comp.lang.tcl)