Q: Oracle on NT, Pro*C and NLS

From: Werner Menges <wernerm_at_hpbbn.bbn.hp.com>
Date: 1997/04/22
Message-ID: <335CD461.4FFD_at_hpbbn.bbn.hp.com>#1/1


Hi all,

  I created a db with the unicode character set AL24UTFFSS   and installed the example tables ( emp table) and inserted   the example data.
  After that I wrote a small program to verify whether   Oracle works on Windows NT 4.0 with Unicode.

  I specified follwoing options within pro*c:

      NLS_CHAR=emp_name[15]
      nls_local=yes
      mode=ANSI
 

  I also set the NLS_LANG (=AMERICAN_AMERICA.AL24UTFFSS).   After running that program the value prints fine but if   I use SQL*Plus to list the table I get a result like that ..

  empno ename

  • --------- 7369 CLERK * that's the example data ... 1200 H U * that's the row I added with my program

  My little program inserts the row on the same way if I   use a db which was created with character set WE8ISO8859P1 (8 bit).

  I'm little bit confused about this behaviour!   What is wrong ?   

  Thanks in advance for any help !!

Attached you find my short example :

#define _UNICODE

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sqlproto.h>
#include <tchar.h>

EXEC SQL BEGIN DECLARE SECTION;

	VARCHAR         username[20];
	VARCHAR         password[20];
	int             emp_number;
	VARCHAR         emp_name[15]; 
	float           salary;
	float           commission;
	short           commission_ind;

EXEC SQL END DECLARE SECTION;         int total_queried;

EXEC SQL INCLUDE sqlca;

void sqlerror(void); /* handles unrecoverable errors */

void main()
{                  

  /* Log onto ORACLE */

   strcpy((char *)username.arr, "SCOTT");         

    ....   

   /* insert data */
    emp_number = 1200;
    salary = 2300;
    _tcscpy(emp_name.arr, L"Hugo");
    emp_name.len = _ftcslen( L"Hugo");   

    EXEC SQL INSERT INTO emp (empno, ename, sal )       VALUES ( :emp_number, :emp_name, :salary);

    EXEC SQL COMMIT;     ...

    EXEC SQL WHENEVER NOT FOUND GOTO notfound;     EXEC SQL SELECT ENAME, SAL, COMM

	INTO :emp_name, 
		     :salary,
		     :commission :commission_ind
	FROM EMP
	WHERE EMPNO = :emp_number;

	...

    wprintf(L"%-8s\t%6.2f\t", emp_name.arr, salary);         

    ....                  

     EXEC SQL COMMIT WORK RELEASE;    /* logoff database */
     exit(0);

} Received on Tue Apr 22 1997 - 00:00:00 CEST

Original text of this message