MySQL Forums
Forum List  »  Newbie

insert current_user() by default
Posted by: Kashif Usmani
Date: February 13, 2013 01:14PM

I have a table like

create table try ( firstname varchar(4), username varchar(4))

My question is that is there a way to insert the current_user() or user() value in the username field by default.

So for example if I am logged in to the database as 'abcduser' then
>insert into try values( 'kashif');
>select * from try

kashif abcduser

Is this possible , just how I can insert defualt timestamp by doing something like

is this is not possible, then what are the alternatives?

Options: ReplyQuote

Written By
insert current_user() by default
February 13, 2013 01:14PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.