Difference between revisions of "Oracle Notes"

From PeformIQ Upgrade
Jump to navigation Jump to search
(Created page with '=Notes= ==cx_Oracle== <pre> >>> import cx_Oracle >>> conn = cx_Oracle.connect('xxxx','xxxx','XX') >>> curs = conn.cursor() >>> curs.arraysize=50 >>> sql = 'SELECT * from DBUSE...')
 
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Notes=
=Notes=
=Exploring Oracle=
* http://www.techonthenet.com/oracle/sys_tables/index.php
<pre>
SELECT table_name FROM user_tables;
select * from all_users;
select * from all_users order by USERNAME;
select * from user_objects where object_type = 'TABLE';
select * from all_objects where object_type = 'TABLE' and OBJECT_NAME = 'BUG';
select * from all_objects where object_type = 'TABLE' and OBJECT_NAME = 'CUSTOMER';
select * from all_objects where object_type = 'TABLE' AND OWNER = 'XXX';
describe USER_TAB_COLUMNS;
describe all_objects;
select * from USER_TAB_COLUMNS;
select * from USER_TAB_COLUMNS;
SELECT owner, table_name FROM dba_tables;
SELECT owner, table_name FROM all_tables;
 
SELECT *  FROM all_tables;
select * from dict;
select * from cols;
</pre>
* http://cisnet.baruch.cuny.edu/holowczak/oracle/sqlplus/#SECTION00051000000000000000


==cx_Oracle==
==cx_Oracle==
Line 29: Line 67:
=== cx_Oracle Working Notes===
=== cx_Oracle Working Notes===


* [http://cx-oracle.sourceforge.net/]
* http://cx-oracle.sourceforge.net/
* [http://cx-oracle.sourceforge.net/html/index.html]
* http://cx-oracle.sourceforge.net/html/index.html
* [http://wiki.oracle.com/page/Python]
* http://wiki.oracle.com/page/Python
* [http://www.oracle.com/technology/pub/articles/devlin-python-oracle.html]
* http://www.oracle.com/technology/pub/articles/devlin-python-oracle.html
* [http://www.oracle.com/technology/pub/articles/tuininga-cx_oracle.html]
* http://www.oracle.com/technology/pub/articles/tuininga-cx_oracle.html


=Python DBI=
=Python DBI=


* [http://www.python.org/dev/peps/pep-0249/]
* http://www.python.org/dev/peps/pep-0249/


[[Category:Oracle]]
[[Category:Oracle]]
[[Category:Database]]
[[Category:Database]]
[[Category:Python]]
[[Category:Python]]

Latest revision as of 22:36, 18 October 2010

Notes

Exploring Oracle

SELECT table_name FROM user_tables;
select * from all_users;
select * from all_users order by USERNAME;
select * from user_objects where object_type = 'TABLE';

select * from all_objects where object_type = 'TABLE' and OBJECT_NAME = 'BUG';

select * from all_objects where object_type = 'TABLE' and OBJECT_NAME = 'CUSTOMER';

select * from all_objects where object_type = 'TABLE' AND OWNER = 'XXX';

describe USER_TAB_COLUMNS;

describe all_objects;

select * from USER_TAB_COLUMNS;

select * from USER_TAB_COLUMNS;

SELECT owner, table_name FROM dba_tables;

SELECT owner, table_name FROM all_tables;
  
SELECT *  FROM all_tables;

select * from dict;

select * from cols;


cx_Oracle

>>> import cx_Oracle
>>> conn = cx_Oracle.connect('xxxx','xxxx','XX')
>>> curs = conn.cursor()
>>> curs.arraysize=50

>>> sql = 'SELECT * from DBUSER.BUG'

>>> curs.execute(sql)
<__builtin__.OracleCursor on <cx_Oracle.Connection to xxx@XX>>

>>> print curs.description
...

>>> print curs.fetchone()
...

>>> for x in curs:
	print x
...

>>> curs.execute('describe XXX.BUG')

cx_Oracle Working Notes

Python DBI