środa, 27 lutego 2013
wtorek, 25 września 2012
DatabaseError: Invalid handle! while reading LOB in Python/cx_Oracle
I've spend much time on this:
orcl = cx_Oracle.connect(usrpass+'@'+dbase)
c = orcl.cursor()
c.execute(sq)
dane = c.fetchall()
orcl.close() # before reading LOB to str
wkt = dane[0][0].read()
And I get: DatabaseError: Invalid handle!
But the following code works, because connection is closed after reading LOB to STR:
orcl = cx_Oracle.connect(usrpass+'@'+dbase)
c = orcl.cursor()
c.execute(sq)
dane = c.fetchall()
wkt = dane[0][0].read()
orcl.close() # after reading LOB to str
[http://stackoverflow.com/questions/8646968/how-do-i-read-cx-oracle-lob-data-in-python/12590977#12590977]
piątek, 30 września 2011
Fork/Join under a condition
After an Activity 1 there is an Activity 2 and - under a certain condition - simultaneously Activity 3. After Act.2 and Act.3 are finished or after only Act.2 is finished (if the condition is not fulfilled) there is an Act.4. The problem is how to model this on an Activity diagram?
Below there are two Act. diagrams showing this situation:
Below there are two Act. diagrams showing this situation:
![]() |
The above diagram comprises a problem. What if the condition is not fulfilled? How long should we wait after Act.2 to start Act.4? |
czwartek, 7 kwietnia 2011
How to count size od tables in Oracle Spatial?
Generally:
SELECT round((bytes/1024/1024/1024),1) size_GB
FROM dba_segments
WHERE owner = <OWNER_NAME> and segment_name = <TABLE_NAME>;
Use the above select for:
1) Table itself.
2) Indexes for the table (put them as <TABLE_NAME> in the above statement). You can retrieve them as follows:
2.1) Indexes:
SELECT index_name
FROM all_indexes
WHERE table_owner = <OWNER_NAME>and table_name = <TABLE_NAME>;
2.2) Spatial indexes:
SELECT sdo_index_table
FROM all_sdo_index_info
WHERE table_owner = <OWNER_NAME>and table_name = <TABLE_NAME>;
środa, 2 marca 2011
Dictionary iteration - ValueError: too many values to unpack
If you get the following error trying to iterate on a dictionary:
ValueError: too many values to unpack
you have forgotten add iteritems() method:
for k,v in dict.iteritems():
print k, v
print k, v
wtorek, 1 marca 2011
How to select value of SDO_GEOMETRY Object
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_objrelschema.htm#i1004087
States:
"Oracle Spatial defines the object type SDO_GEOMETRY as:
CREATE TYPE sdo_geometry AS OBJECT (
SDO_GTYPE NUMBER,
SDO_SRID NUMBER,
SDO_POINT SDO_POINT_TYPE,
SDO_ELEM_INFO SDO_ELEM_INFO_ARRAY,
SDO_ORDINATES SDO_ORDINATE_ARRAY); "
Let's assume we have a "TABLE" with SDO_GEOMETRY Type field named "GEOM".
If you want to get the values of certain SDO_GEOMETRY Type field and make query like this:
select geom.SDO_GTYPE from table;
You'll get ORA-00904 Error: "invalid identifier".
Try with table name alias:
select t.geom.SDO_GTYPE from table t;
GEOM.SDO_GTYPE
----------------------
2003
piątek, 11 lutego 2011
Subskrybuj:
Posty (Atom)