Database Info
SELECT  SYS.database_name,
 sys.standard.sqlcode  SQL_CODE,
 sys.standard.sqlerrm  SQL_ERRM 
FROM DUAL;

SELECT sys.standard.sqlerrm(-level) sql_errm
FROM DUAL CONNECT BY level <= 20;

--> First 20 Error Messges

--Reference Temperature conversion (F to C and C to F)

SELECT  q_t.i_deg  f_deg,  ((q_t.i_deg-32)/9)*5 c_deg,
        q_t.i_deg  c_deg,  ((q_t.i_deg*9)/5)+32 f_deg
FROM (SELECT &i_deg  i_deg  FROM DUAL) q_t;

--The Directory Path (server)

SELECT level, SYS_CONNECT_BY_PATH('/', '..') dir_path 
FROM DUAL CONNECT BY LEVEL < 5;

--The Calendar Summary

SELECT 
  level month_no, 
  NTILE(4) OVER (ORDER BY level) As Quarter, 
  TO_CHAR(ADD_MONTHS(TRUNC(SYSDATE,'year'),level-1),'mm/dd/yyyy') start_date, 
  TO_CHAR(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'year'),level-1)),'mm/dd/yyyy') end_date, 
  LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'year'),level-1))- ADD_MONTHS(TRUNC(SYSDATE,'year'),level-1)+1 month_days, 
  SUM(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'year'),level-1)) - ADD_MONTHS(TRUNC(SYSDATE,'year'),level-1)+1)
     OVER (ORDER BY level) ytd_days 
FROM DUAL
 CONNECT BY level <= 12;

--The ASCII Table

SELECT level, chr(level) chr_value FROM DUAL CONNECT BY level <= 256; --Random Number, dbms_crypto.randombytes SELECT ROUND(10000*DBMS_RANDOM.value) val1, ROUND(10000*DBMS_RANDOM.value) val2 -- , dbms_crypto.randombytes(1) dc_val -- priv FROM DUAL; --SQL Model Clause (Oracle documentation) SELECT x, s FROM DUAL MODEL DIMENSION BY (1 AS x) MEASURES (1024 AS s) RULES UPDATE ITERATE (5) (s[1] = s[1]/2); SELECT x, s, iterations FROM DUAL MODEL DIMENSION BY (1 AS x) MEASURES (1024 AS s, 0 AS iterations) RULES ITERATE (1000) UNTIL ABS(PREVIOUS(s[1]) - s[1]) < 1 (s[1] = s[1]/2, iterations[1] = ITERATION_NUMBER);

Back

Oracle registered trademark of Oracle Corporation.


  199