Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Perl DBI query of MS SQL with LIKE

by Corion (Patriarch)
on May 29, 2023 at 09:45 UTC ( [id://11152454]=note: print w/replies, xml ) Need Help??


in reply to Perl DBI query of MS SQL with LIKE

How did you verify that $transactionCodeQuery contains exactly what you think it should? Does it contain whitespace?

Replies are listed 'Best First'.
Re^2: Perl DBI query of MS SQL with LIKE
by Fletch (Bishop) on May 29, 2023 at 11:36 UTC

    In addition to verifying before you call, using the DBI trace method to watch what actually is passed to the DB can help.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      Thank You for your sharing your wisdom!

      Corion, Yes the query contains spaces and even a #. I had only verified $transactionCodeQuery by printing it to STDOUT. At 2am I was not comprehending how to TRACE.

      Fletch, I have just learned how to use TRACE and added it to my statement handle.
      Trace Output at level 5: DBI::st=HASH(0x4a7dff0) trace level set to 0x0/5 (DBI @ 0x0/0) in +DBI 1.643-ithread (pid 16980) -> execute for DBD::ODBC::st (DBI::st=HASH(0x4a7e038)~0x4a7dff0 'N +DC #29300-0415-10%') thr#f66fe8 +dbd_bind_ph(4a7ded0, name=1, value='NDC #29300-0415-10%', attribs +=, sql_type=0(unknown), is_inout=0, maxlen=0 First bind of this placeholder -dbd_bind_ph=rebind_param +rebind_param 1 'NDC #29300-0415-10%' (size SvCUR=19/SvLEN=21/max= +0) svtype:3, value type:1, sql type:0 +get_param_type(4a7ded0,1) SQLDescribeParam 1: SqlType=VARCHAR(12) param_size=40 Scale=0 Nu +llable=0 check_for_unicode_param - sql_type=unknown, described=VARCHAR bind 1 'NDC #29300-041...' value_len=19 maxlen=19 null=0) bind 1 value_type:1 VARCHAR cs=40 dd=0 bl=19 SQLBindParameter: idx=1: io_type=1, name=1, value_type=1 (SQL_C_CH +AR), SQLType=12 (VARCHAR), column_size=40, d_digits=0, value_ptr=48ae +598, buffer_length=19, ind=19, param_size=40 Param value = NDC #29300-0415-10% -rebind_param +dbd_st_execute_iv(4a7ded0) dbd_st_finish(4a7ded0) outparams = 0 SQLNumResultCols=0 (flds=1) dbd_describe done_desc=0 dbd_describe SQLNumResultCols=0 (columns=1) now using col 1: type = UNICODE VARCHAR (-9), len = 20, display s +ize = 20, prec = 9, scale = 0 -dbd_describe done_bind=0 have 1 fields -dbd_st_execute_iv(4a7ded0)=0 <- execute= ( '0E0' ) [1 items] at C:\PrimeRxToLytec\bin\PrimeRxTo +Lytec.pl line 814 -> fetchrow_array for DBD::ODBC::st (DBI::st=HASH(0x4a7e038)~0x4a7 +dff0) thr#f66fe8 bind_columns fbh=3d55af8 fields=1 Bind 1: type = UNICODE CHAR(-8), buf=48ad8d8, buflen=20 bind_columns=0 SQLFetch=100 dbd_st_finish(4a7ded0) <- fetchrow_array= ( ) [0 items] at C:\PrimeRxToLytec\bin\PrimeRxT +oLytec.pl line 817 -> finish for DBD::ODBC::st (DBI::st=HASH(0x4a7e038)~0x4a7dff0) th +r#f66fe8 <- finish= ( 1 ) [1 items] at C:\PrimeRxToLytec\bin\PrimeRxToLytec +.pl line 838 -> DESTROY for DBD::ODBC::st (DBI::st=HASH(0x4a7dff0)~INNER) thr#f +66fe8 <- DESTROY= ( undef ) [1 items] at C:\PrimeRxToLytec\bin\PrimeRxTo +Lytec.pl line 1254 via at C:\PrimeRxToLytec\bin\PrimeRxToLytec.pl li +ne 1254
      Thank You Again for the assistance!!!

      glenn
        My apologies! It is working! I was misreading the messages from the script. I just double checked the TRACE with a known entry and I got the proper response.

        Thank You both for pointing me in the right direction!!! I have now learned about TRACE. :-)

        glenn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11152454]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-03-28 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found