reverse

Oracle: using DBMS_METADATA for getting table structure

Monday, March 17th, 2008

SET LONG 5000
SELECT dbms_metadata.get_ddl(’TABLE’,'EMP’,'SCOTT’);

Oracle: source text for the view, package etc

Friday, January 25th, 2008

Source text of the package

SELECT text
FROM dba_source
WHERE upper(name) LIKE upper(’&which_object’)
ORDER BY line ;

Use $ORACLE_HOME/bin/wrap utility to encrypt the package (there is no unwrap)
(Well, actually, there is unwrap - just look in the search machine for the words unwrap10 or rewrap…)
Source text of the views

SET long 5000
col text FOR a80
SELECT text FROM dba_views WHERE view_name = [...]

Rev function and comma-separated output

Thursday, February 2nd, 2006

Here is the shell command snippet to display comma-separated output:
ls -lrt | rev | sed ’s/\\([0-9][0-9][0-9]\\)/\\1,/g’ | rev | sed ’s/\\([\^0-9]\\),\\([0-9]\\)/\\1\\2/g;s/\^,\\([0-9]\\)/\\1/g’
Example:
-rw-r—– 1 sybase dba 1,572,872,192 Feb 2 07:09 master.dbf
Rev function (absent on SunOS) :
(Warning! Avoid spaces before #define - SunOS cc compiler doesn’t like them)

#include <stdio.h>
#ident  "@(#)rev 1.0  [...]

Keep on coding