Showing posts with label PL/SQL. Show all posts
Showing posts with label PL/SQL. Show all posts

Thursday, 21 February 2013

PL/SQL: Script translate view to create table

Basic script, boleh modify lagi untuk PK, nullable dll.
...
 SELECT ' "' || COLUMN_NAME || '" ' || DATA_TYPE || ' (' || data_length || ' ' || decode(char_used,'B','BYTE') || ') , '  
 FROM user_tab_columns   
 WHERE table_name='TABLE_NAME'  
 ;  

Thursday, 7 February 2013

PL/SQL: dba_data_files


Selalu lupa mana letaknya EM? Macam mana nak akses EM untuk modify/view tablespace?
atau prefer guna sqldeveloper/sqlplus

Boleh query gunakan table dba_data_files

SELECT file_name, tablespace_name, ROUND(bytes/1024000) MB
FROM dba_data_files
ORDER BY 1;

desc dba_data_files;

select * from dba_data_files;

alter database datafile
   'imsdata.dbf'
autoextend on;