Total Pageviews

4504

SQL and PL/SQL

List Users

List all users that are visible to the current user:

SQL> SELECT * FROM all_users;
List all users in the Oracle Database:

SELECT * FROM dba_users;
Show the information of the current user: 
SELECT * FROM user_users;

Find first date and last date of current and previous year in Oracle


[First Day of Current Year]:

SELECT TRUNC (SYSDATE , 'YEAR') FROM DUAL;

[Last Day of Current Year]:

SELECT ADD_MONTHS(TRUNC (SYSDATE ,'YEAR'),12)-1 FROM DUAL;

[First Day of Previous Year]:

SELECT ADD_MONTHS (TRUNC (SYSDATE,'YEAR'), -12) FROM DUAL;

[Last Day of Previous Year]:

SELECT ADD_MONTHS (TRUNC (SYSDATE, 'YEAR'), -1 ) +30 FROM DUAL;

 

No comments:

Post a Comment

ORA-00845: MEMORY_TARGET not supported on this system

 The shared memory file system should have enough space to accommodate the MEMORY_TARGET and MEMORY_MAX_TARGET values. To verify: SQL> sh...