Introduction of Oracle System Variable Function

  • 2021-12-21 05:30:28
  • OfStack

There are many kinds of Oracle functions, and the system variable function is one of them. Here are three most common system variable functions, hoping to help you learn Oracle.

Oracle system variable function:

(1) SYSDATE

This function returns the current date and time. Returns the current date and time of the Oracle server.

select sysdate from dual;
insert into purchase values
('Small Widget', 'SH', sysdate, 10);
insert into purchase values
('Meduem Wodget', 'SH', sysdate-15, 15);

To view all sales records for the last 30 days, use the following command:

select * from purchase
where purchase_date between (sysdate-30) and sysdate;

(2) USER

View the user name.

select user from dual;

(3) USERENV

View all kinds of information about the user environment.

select userenv ('TERMINAL') FROM dual;

The above introduction of Oracle system variable function.


Related articles: