• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need a set of eyes...

 
Pat Peg
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've posted below the SQL I am using. I have checked and re-checked my statement but
I can find nothing wrong with it. Can someone else please give it a glance and tell me
why I am getting the ORA-01747 error message?


SQL> DESC DEV.MY_USERS
NameNull? Type
--------------------------------------- --------- -------------------
USER_IDNOT NULL VARCHAR2(20)
GROUP NUMBER(10)

SQL> SELECT *
2 FROM DEV.MY_USERS;

USER_ID GROUP
----------------- --------
MyUse 9

SQL> SELECT MY_USERS.GROUP
2 FROM DEV.MY_USERS
3 WHERE MY_USERS.USER_ID = 'MyUse';
SELECT MY_USERS.GROUP
*
ERROR at line 1:
ORA-01747: invalid user.table.column, table.column, or column specifications
 
Pat Peg
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know why it works but I renamed the column GROUP to GRP and now everything works.
 
Christa Koch
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pat, I'm eager to help you and so I tried to create your table in my database but I couldn't: the attribute name "group" was not accepted, probably because it's a reserved word. That lead me to the solution of your problem: Try changing the beginning of you statement to

SELECT "GROUP" ...
 
Pat Peg
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christa, That's it exactly. I can't use 'GROUP'. I don't know why it let me name the column that but it isn't a good idea from what I can see. Changed the name and everything works fine now
 
Christa Koch
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pat, that's what I asked myself: Why did Pat's database accept the attribute name group and mine doesn't? I managed to create the table with this trick:

create table my_users (user_id varchar2(20) not null,"GROUP" number(10));
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic