DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: Help with capturing user into Modified_by cloumn!!!

  1. #1
    Join Date
    Jun 2004
    Posts
    125

    Help with capturing user into Modified_by cloumn!!!

    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
    )

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166

    Re: Help with capturing user into Modified_by cloumn!!!

    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?

  3. #3
    Join Date
    Jun 2004
    Posts
    125
    sorry guys, it does work. Thanks gandolf989 for the reply though.

  4. #4
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    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.

    Code:
    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

  5. #5
    Join Date
    Jun 2004
    Posts
    125
    Well, you need the parenthesis around sysdate and user. Try that

  6. #6
    Join Date
    Jun 2004
    Posts
    125
    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.

  7. #7
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width