Ok, let’s say that you need to turn some rows into columns. For example, you have a table where you have information of a person span over several records. Record 1 contains the type of the person like this: person_id, attribute_id and value. example : 123,...
Oracle simple delete...
posted by xav
Well, this is a fine statement to delete duplicates in a table : DELETE FROM table1 A WHERE A.rowid > ANY ( SELECT B.rowid FROM table1 B WHERE A.ID = B.ID and any additional condition ) and other conditions on...
Get the size of you...
posted by xav
Here goes a simple SQL to retrieve the amount of space that a partioned takes (partion by partition) in MB. select partition_name, bytes/1024/1024 as size_mb from dba_segments where segment_name = 'YOUR_TABLE' order by 1 There you all your partions in MB.
Get your Oracle DB c...
posted by xav
Here goes one fine and simple SQL statement to get your character set from your Oracle DB. SELECT * FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET' That’s it.
Oracle : random samp...
posted by xav
How to retrieve a random sample of a percentage of a table’s rows ? Here goes the shorty for Oracle. Maybe there is another solution. But that one worked for me. select * from (select * from table order by dbms_random.value) where rownum <= (select...
PHP and Oracle
posted by xav
Here goes a tiny snippet that should get you started by using Oracle as your database instead of the classic MySql RDBMS. <?php // At first, get connected to the instance of your RDBMS $conn = oci_connect("user", "password",...
Oracle Partitions
posted by xav
Oracle Partitioning enhances the manageability, performance, and availability of database applications. Partitioning allows tables, indexes, and index-organized tables to be subdivided into smaller pieces, enabling these database objects to be managed and accessed at a finer level of...


Abduzeedo