Suppose there are multiple statements like this:
select T_JGDM_20160811.JJLX from T_JGDM_20160811 where rownum < 30;
select T_JGDM.JJLX from T_JGDM where rownum < 30;
...
We can summarize it into the format of select xxx from yyy
, how to execute multiple such statements at one time in Python, where xxx and yyy are variable.
给我你的怀抱2017-05-25 15:10:08
You can extract xxx and yyy as variables
pram = [
(1111, 2222),
(2222, 3333)
...(自己补充)
]
for table, db in pram:
sql = 'select %s from %s' % (table, db)
print sql # 此处自行替换具体代码