Click to See Complete Forum and Search --> : Help with capturing user into Modified_by cloumn!!!
see_one
08-26-2004, 03:47 PM
Hi,
I am creating a table and want to make the default to ('user')but it's not working if you know the right syntax, let me know. If you can help, that would be just greaaat!!! Thanks Peter. :)
Example:
create table region (
name varcha2(14),
date_created Date Default (Sysdate) not null,
modified_by varchar2(30) Default (user) not null
)
gandolf989
08-26-2004, 04:00 PM
Originally posted by see_one
create table region (
name varchar2(14),
date_created Date Default Sysdate not null,
modified_by varchar2(30) Default user not null);
Why dosn't this work?
see_one
08-26-2004, 05:00 PM
sorry guys, it does work. Thanks gandolf989 for the reply though.
gandolf989
08-26-2004, 05:17 PM
Originally posted by see_one
sorry guys, it does work. Thanks gandolf989 for the reply though.
When you try to create a table what error message that you get?
This is what happens when I run it. I don't have the create table privilege.
SQL> create table region (
2 name varchar2(14),
3 date_created Date Default Sysdate not null,
4 modified_by varchar2(30) Default user not null);
create table region (
*
ERROR at line 1:
ORA-01031: insufficient privileges
Elapsed: 00:00:00.63
see_one
08-26-2004, 05:48 PM
Well, you need the parenthesis around sysdate and user. Try that :)
see_one
08-26-2004, 05:56 PM
Hey, I know guys the (user) works but it's getting the name Oracle for all the changes since everybody is using the same schema Oracle. Is there a way to get the username? Because in DBA Studio it does show me the different users under Instance > Sessions and OS USER. I tried using OS_USER and OSUSER but it does not work. I know how to capture it from form by using Windows API but if someone know a way to do it that would be great. Thanks.
gandolf989
08-26-2004, 06:20 PM
Originally posted by see_one
everybody is using the same schema Oracle.
Doing this creates problems. you need to rethink your security in your application.
You will need to create a trigger and look at user context in relation to the v$session view.