FAQ
Hi,

I have a table containing CHAR, VARCHAR2, NUMBER and DATE fields.

Is there any way or command to find out the record length in bytes.

This can be useful while defining a Buffer in Pro*C to handle a record.

Thanks in Advance.

Harsh
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Harsh Agrawal
INET: HARSHA_at_Amdocs.com

Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------

To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).

Search Discussions

  • Trassens, Christian at Mar 12, 2001 at 2:30 pm
    vsize( ). You can use it through PL/SQL or SQL.

    Regards.
    -----Mensaje original-----
    De: Harsh Agrawal [SMTP:HARSHA_at_Amdocs.com]
    Enviado el: lunes 12 de marzo de 2001 14:31
    Para: Multiple recipients of list ORACLE-L
    Asunto: Record Length ...

    Hi,

    I have a table containing CHAR, VARCHAR2, NUMBER and DATE fields.

    Is there any way or command to find out the record length in bytes.

    This can be useful while defining a Buffer in Pro*C to handle a record.

    Thanks in Advance.

    = Harsh
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Harsh Agrawal
    INET: HARSHA_at_Amdocs.com

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message
    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Trassens, Christian
    INET: CTrassens_at_uni2.es

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message
    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
  • Harsh Agrawal at Mar 12, 2001 at 4:03 pm
    Thanks,

    But it gives bytes for "current status of field".
    i.e. if field is empty or filled it will be different.

    This makes the assumption that at least one record must be having all fields
    filled except CHAR, to know the maxm recd length. Right ?

    -----Original Message-----
    Sent: Monday, March 12, 2001 3:56 PM
    To: Multiple recipients of list ORACLE-L

    vsize( ). You can use it through PL/SQL or SQL.

    Regards.
    -----Mensaje original-----
    De: Harsh Agrawal [SMTP:HARSHA_at_Amdocs.com]
    Enviado el: lunes 12 de marzo de 2001 14:31
    Para: Multiple recipients of list ORACLE-L
    Asunto: Record Length ...

    Hi,

    I have a table containing CHAR, VARCHAR2, NUMBER and DATE fields.

    Is there any way or command to find out the record length in bytes.

    This can be useful while defining a Buffer in Pro*C to handle a record.
    Thanks in Advance.

    = Harsh
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Harsh Agrawal
    INET: HARSHA_at_Amdocs.com

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message
    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Trassens, Christian
    INET: CTrassens_at_uni2.es

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message
    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Harsh Agrawal
    INET: HARSHA_at_Amdocs.com

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------
    To REMOVE yourself from this mailing list, send an E-Mail message
    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
  • Dgoulet_at_vicr.com at Mar 12, 2001 at 6:07 pm
    Harsh,

    Are you talking about a 'host variable'? In that case look at the declared
    size of the field as in:

    NBRAHMS:8.04:GOULET> desc module_master

    Name Null? Type
    ---------------------------------------- -------- --------------
    MODULE_ID NOT NULL VARCHAR2(13)
    MODEL_NUMBER NOT NULL VARCHAR2(20)
    SERIAL_NUMBER VARCHAR2(15)
    LAST_TEST_DATE DATE
    ARCH_TAPE_ID NUMBER

    Now to declare a host variable for this tables stuff I'd use:

    EXEC SQL BEGIN DECLARE SECTION;

    VARCHAR module_id[14];
    VARCHAR model_number[21];
    VARCHAR serial_number[16];
    VARCHAR last_test_date[12];
    int arch_tape_id;
    EXEC SQL END DECLARE SECTION;

    The point is that for each character data type you need to allow for a full
    variable + one for the null terminator. This is because Oracle does not null
    terminate the data when it hands it back so since a VARCHAR data type is a
    structure you have both the character data & the length as in:

    /*VARCHAR model_number[21] */
    struct
    { arr[21];

    len;
    }model_number;

    So after retrieving a data point you need to:

    model_number.arr[model_number.len] = '\0';

    Dick Goulet

    ____________________Reply Separator____________________
    Author: Harsh Agrawal
    Date: 3/12/2001 5:30 AM

    Hi,

    I have a table containing CHAR, VARCHAR2, NUMBER and DATE fields.

    Is there any way or command to find out the record length in bytes.

    This can be useful while defining a Buffer in Pro*C to handle a record.

    Thanks in Advance.

    Harsh
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Harsh Agrawal
    INET: HARSHA_at_Amdocs.com

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------

    To REMOVE yourself from this mailing list, send an E-Mail message
    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author:
    INET: dgoulet_at_vicr.com

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------

    To REMOVE yourself from this mailing list, send an E-Mail message
    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
  • Tapas dutta at Mar 15, 2001 at 5:29 am
    Use the command vsize. The format is vsize(coulmn_name)
    But you have to write some pl/sql code for the purpose.

    Regards,
    Tapas

    -----Original Message-----
    From: Harsh Agrawal [SMTP:HARSHA_at_Amdocs.com]
    Sent: Monday, March 12, 2001 7:01 PM

    To: Multiple recipients of list ORACLE-L
    Subject: Record Length ...

    Hi,

    I have a table containing CHAR, VARCHAR2, NUMBER and DATE fields.

    Is there any way or command to find out the record length in bytes.

    This can be useful while defining a Buffer in Pro*C to handle a record.

    Thanks in Advance.

    Harsh
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: Harsh Agrawal
    INET: HARSHA_at_Amdocs.com

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------

    To REMOVE yourself from this mailing list, send an E-Mail message
    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    --
    Author: tapas dutta
    INET: tapasoracle_at_umtl.co.in

    Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
    San Diego, California -- Public Internet access / Mailing Lists
    --------------------------------------------------------------------

    To REMOVE yourself from this mailing list, send an E-Mail message
    to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
    the message BODY, include a line containing: UNSUB ORACLE-L
    (or the name of mailing list you want to be removed from). You may
    also send the HELP command for other information (like subscribing).

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouporacle-l @
categoriesoracle
postedMar 12, '01 at 1:43p
activeMar 15, '01 at 5:29a
posts5
users4
websiteoracle.com

People

Translate

site design / logo © 2022 Grokbase