|
-
Doubts on the trimed Spaces
I am using Pro*C for Oracle8.1.7
I have a doubt on Varchar2 column :
Describing emp....
NAME Null? Type
------------------------------- --------- -----
EMPNO NOT NULL NUMBER(4,0)
ENAME VARCHAR2(10)
But the ENAME stores only 5 chars
In .PC file
typedef char asciiz[11];
EXEC SQL TYPE asciiz IS CHARZ(11) REFERENCE;
struct emp_info
{
asciie emp_name;
float salary;
float commission;
};
...
EXEC SQL DECLARE salespeople CURSOR FOR
SELECT RTRIM(ENAME), SAL, COMM
FROM EMP
WHERE JOB LIKE 'SALES%';
.......
for (;
{
EXEC SQL FETCH salespeople INTO :emp_rec_ptr;
printf("%s %9.2f %12.2f\n", emp_rec_ptr->emp_name,
emp_rec_ptr->salary, emp_rec_ptr->commission);
printf("length (name) = %d \n",strlen(emp_rec_ptr->emp_name));
}
It shows the length of emp_name is 10 ( right padded space )
Why it happens like that ?
1. www.dbasupport.com
2. www.dbforums.com
3. www.itpub.net
4. www.csdn.net
5. www.umlchina.com
6. www.tek-tips.com
7. www.cnforyou.com
8. fm365.federal.com.cn
9. www.programmersheaven.com
10.http://msdn.microsoft.com/library/default.asp
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|