Skip navigation links

MySQL Forums :: Newbie :: insert current_user() by default


Advanced Search

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
ARRIVAL_TIME timestamp not null DEFAULT CURRENT_TIMESTAMP

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

Options: ReplyQuote


Subject Written By Posted
insert current_user() by default Kashif Usmani 02/13/2013 01:14PM
Re: insert current_user() by default Peter Brawley 02/13/2013 03:00PM
Re: insert current_user() by default Kashif Usmani 02/13/2013 08:07PM
Re: insert current_user() by default Peter Brawley 02/13/2013 09:38PM
Re: insert current_user() by default Phillip Ward 02/14/2013 06:23AM


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.