File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ import cx_Oracle
2+ import sys
3+ import os
4+
5+ if os .path .exists ("statenums" ):
6+ os .remove ("statenums" )
7+ else :
8+ print ("No results file here" )
9+
10+
11+
12+ cx_Oracle .init_oracle_client (lib_dir = "/usr/lib/oracle/21/client64/lib" )
13+
14+ con = cx_Oracle .connect (user = "boss" , password = "yogamats" , dsn = "adwyoga_low" )
15+
16+ sys .stdout = open ('statenums' , 'w' )
17+
18+ cur = con .cursor ()
19+
20+ sql0 = "select count(distinct state) from jun2021yogadata"
21+
22+ cur .execute (sql0 )
23+ res = cur .fetchall ()
24+ total_records = (res [0 ][0 ])
25+ #print(total_records, "Records Produced By Query")
26+
27+ cur .prefetchrows = total_records
28+ cur .arraysize = total_records
29+ #cur.execute(sql0)
30+
31+ #print()
32+ #print()
33+
34+ #print(total_records)
35+ #res = cur.fetchall()
36+
37+ sql1 = "select distinct state from jun2021yogadata order by state asc"
38+
39+ cur .execute (sql1 )
40+ res = cur .fetchall ()
41+
42+
43+ for x in res :
44+
45+ sql2 = "select count(*) from jun2021yogadata where state = :id"
46+
47+ cur .execute (sql2 , id = x [0 ])
48+
49+ record = cur .fetchall ()
50+ print (record , x [0 ])
51+
52+
53+
54+
55+
56+ sys .stdout .close ()
57+
You can’t perform that action at this time.
0 commit comments