When you change or insert data in an Oracle table, and when you receive data from Oracle on a query, the data passes between variables in your program and columns in the Oracle table. Oracle represents data internally in several formats. Among them are NUMBER, CHAR, DATE, and RAW.
Your OCI program stores data in variables, whose types are predefined by the language you are using. When you transfer data between Oracle and your program, you need to specify the format of the data in your program. For example, if you are processing the SQL statement
SELECT sal FROM emp WHERE empno = :employee_number
and you want the salary to come back as character data, rather than in a binary floating-point format, specify an Oracle external string datatype, such as VARCHAR2 (code = 1) or CHAR (code = 96) for the FTYPE parameter in the ODEFIN call. You also need to declare a string variable in your program and specify its address in the BUF parameter.
If you want the salary information to be returned as a binary floating-point value, however, specify the FLOAT (code = 4) external datatype. You also need to define a variable of the appropriate type for the BUF parameter.
Oracle performs most data conversions transparently. The ability to specify almost any external datatype provides a lot of power for performing specialized tasks. For example, you can input and output DATE values in pure binary format, with no character conversion involved, by using the DATE external datatype (code = 12). See the description of the DATE external datatype [*] for more information.
To control data conversion, you must use the appropriate external datatype codes in the bind and define routines, such as OBNDRA or ODEFIN. You must tell Oracle where the input or output variables are in your OCI program and their datatypes and lengths.
When you change or insert data in an Oracle table, and when you receive data from Oracle on a query, the data passes between variables in your program and columns in the Oracle table. Oracle represents data internally in several formats. Among them are NUMBER, CHAR, DATE, and RAW.Your OCI program stores data in variables, whose types are predefined by the language you are using. When you transfer data between Oracle and your program, you need to specify the format of the data in your program. For example, if you are processing the SQL statementSELECT sal FROM emp WHERE empno = :employee_numberand you want the salary to come back as character data, rather than in a binary floating-point format, specify an Oracle external string datatype, such as VARCHAR2 (code = 1) or CHAR (code = 96) for the FTYPE parameter in the ODEFIN call. You also need to declare a string variable in your program and specify its address in the BUF parameter.If you want the salary information to be returned as a binary floating-point value, however, specify the FLOAT (code = 4) external datatype. You also need to define a variable of the appropriate type for the BUF parameter.Oracle performs most data conversions transparently. The ability to specify almost any external datatype provides a lot of power for performing specialized tasks. For example, you can input and output DATE values in pure binary format, with no character conversion involved, by using the DATE external datatype (code = 12). See the description of the DATE external datatype [*] for more information.To control data conversion, you must use the appropriate external datatype codes in the bind and define routines, such as OBNDRA or ODEFIN. You must tell Oracle where the input or output variables are in your OCI program and their datatypes and lengths.
การแปล กรุณารอสักครู่..