OCI Bind for RAW field, Cannot select a record matching a hexadecimal Key (raw type)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anand Mamuder

    OCI Bind for RAW field, Cannot select a record matching a hexadecimal Key (raw type)

    Greetings,
    I have a table MYTABLE ( msg_id RAW(24) NOT NULL) , .....)
    msg_id is the key,

    If I wanted to select a record using the OCI, the select is failing. I
    can see that the value exists using sqlplus. I guess I am not doing
    the Bind correctly.
    '414D51204D4552 542020202020202 0203F2293C209CB D012' is a example value
    for msg_id, obtained from the select in SQLplus, when i use the OCI
    app
    I have the value
    char tmp_str[] ="414D51204D455 254202020202020 20203F2293C209C BD012");
    unsigned char mid_var[48];
    memcpy(&mid_var ,tmp_str,48); //to clear the null termination

    select count(*) from MYTABLE where msg_id = :msg_input;

    I do allocate the handles, prepare,define and all the other stuff.
    I do a Bind with
    rc = OCIBindByName(p _sql,
    &p_bnd,
    p_err,
    (text *) ":msg_input ",
    -1,
    (dvoid *)&mid_var,
    sizeof(24), //tried with sizeof(48) - doesnt help
    SQLT_BIN,// tried with SQLT_CHR - doesnt help
    (dvoid *) 0,
    (ub2 *) 0,
    (ub2 *) 0,
    (ub4) 0,
    (ub4 *) 0,
    OCI_DEFAULT);

    and the execution returns nothing.
    PLEASE provide me with sample code that you can bind and retrieve data
    based off the primary key of RAW type.
    Help is greatly appreciated.
    Many thanks,
Working...