ALTER TABLE my_table ENABLE ROW MOVEMENT;
Friday, November 22, 2013
Oracle: ORA-14402: updating partition key column would cause a partition change
This can be circumvented with:
Thursday, November 21, 2013
Wednesday, November 20, 2013
Oracle: aggregate data from a number of rows into a single row
Base Data:
DEPTNO ENAME
---------- ----------
20 SMITH
30 ALLEN
30 WARD
20 JONES
30 MARTIN
30 BLAKE
10 CLARK
20 SCOTT
10 KING
30 TURNER
20 ADAMS
30 JAMES
20 FORD
10 MILLER
SELECT deptno, LISTAGG(ename, ',') WITHIN GROUP (ORDER BY ename) AS employees
FROM emp
GROUP BY deptno;
DEPTNO EMPLOYEES
---------- --------------------------------------------------
10 CLARK,KING,MILLER
20 ADAMS,FORD,JONES,SCOTT,SMITH
30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
Thursday, November 14, 2013
jQuery: Have UI datetimepicker 'Now' button use UTC time?
This solution requires an update of the source code:
http://stackoverflow.com/a/17833188/732797
http://stackoverflow.com/a/17833188/732797
Monday, November 11, 2013
Windows 8: Could'nt upgrade to Windows 8.1
If ever you meet this stupid error in the process of upgrading to Windows 8.1:
In this case, change the options in the BIOS in order to boot on the Windows HDD, upgrade, then restore as before.
"Could'nt update to Windows 8.1. Sorry, we couldn't complete the update to Windows 8.1 We've restored your previous version of Windows to this PC. ERROR CODE: 0x80070002 - 0x20009."This is most likely because the HDD on which Windows has been installed in not the one you booted on.
In this case, change the options in the BIOS in order to boot on the Windows HDD, upgrade, then restore as before.
Thursday, November 7, 2013
PL SQL: Convert array into SQL table
Use:
SELECT COLUMN_VALUE FROM TABLE(my_array)Beware to use only SQL array types or you will get the following error a run time (at least with Oracle 11.2.0.1):
ORA-21700: object does not exist or is marked for delete
E.g.
CREATE OR REPLACE TYPE MBQT_DB.ID_ARRAY_TYPE IS TABLE OF VARCHAR2(20); / GRANT EXECUTE ON MBQT_DB.ID_ARRAY_TYPE TO PUBLIC;
Wednesday, November 6, 2013
PL SQL: open ref cursor from explicit cursor
PROCEDURE my_proc(x_ref_cursor OUT sys_refcursor) IS
TYPE my_array_type IS TABLE of MY_TABLE%ROWTYPE;
my_array my_array_type;
BEGIN
OPEN x_ref_cursor FOR SELECT * FROM MY_TABLE;
FETCH x_ref_cursor BULK COLLECT INTO my_array;
-- Do something with my_array...
FORALL i IN 1 .. my_array.COUNT
INSERT INTO MY_TABLE2 (
col1,
col2,
col3)
VALUES (
my_array(i).col1,
my_array(i).col2,
my_array(i).col3
);
END;
Subscribe to:
Comments (Atom)