1. Print Date and time using sysdate:
SELECT TO_CHAR (SYSDATE, 'DD-MM-YY HH:MI:SS') FROM DUAL;
2. Print Numbers from 1 to 10.
SELECT ROWNUM r
FROM DUAL
CONNECT BY ROWNUM <= 10;
3. Kill Session
alter system kill session '1266,54057'; --'sid, serial#'
4. Gather Schema stats:
begin
DBMS_STATS.GATHER_TABLE_STATS('AP','AP_SUPPLIER_SITES_ALL');
end;
/
5. Remove special (control chars) characeters from the string
SELECT REGEXP_REPLACE(colx, '[[:cntrl:]]', ' ') FROM xx_tab;
6. REPLACE ONE OR MORE COMMAS WITH SINGLE COMMA AND SPACE
select regexp_replace(' Address Line1,,Addressline3,,Postal Code,,57000 ',',{1,}', ', ') from dual;
SELECT TO_CHAR (SYSDATE, 'DD-MM-YY HH:MI:SS') FROM DUAL;
2. Print Numbers from 1 to 10.
SELECT ROWNUM r
FROM DUAL
CONNECT BY ROWNUM <= 10;
3. Kill Session
alter system kill session '1266,54057'; --'sid, serial#'
4. Gather Schema stats:
begin
DBMS_STATS.GATHER_TABLE_STATS('AP','AP_SUPPLIER_SITES_ALL');
end;
/
5. Remove special (control chars) characeters from the string
SELECT REGEXP_REPLACE(colx, '[[:cntrl:]]', ' ') FROM xx_tab;
6. REPLACE ONE OR MORE COMMAS WITH SINGLE COMMA AND SPACE
select regexp_replace(' Address Line1,,Addressline3,,Postal Code,,57000 ',',{1,}', ', ') from dual;
No comments:
Post a Comment