我有一个案例,我必须在select语句中的240列中选择100列,因为我已使用下面的查询来获取那些100 coliumn但在select语句中无法使用它们
查询:
选择listagg(column_name,',')WITHIN GROUP(ORDER BY column_name)as col_name
来自all_tab_cols
其中lower(column_name)类似于' test%'
结果:
COL_NAME
为test1,TEST2,TEST3,.... test100
预期输出:
在select语句中使用这些结果值
从表中选择test1,test2,test3 .... test100;
提前致谢
答案 0 :(得分:1)
动态查询就是您想要的。您可以在存储过程或函数内使用以下两个查询。
from matplotlib import pyplot
from matplotlib.widgets import Slider
import matplotlib.pyplot as plt
import numpy as np
a = np.random.randint(10, size = 4)
b = np.random.randint(10, size = 4)
c = np.random.randint(10, size = 4)
d = np.random.randint(10, size = 4)
grid = ((a,b),(c,d))
grid = np.array(grid)
fig = plt.figure(figsize=(7,5))
ax = fig.add_subplot(111)
subplots_adjust(left=0.15, bottom=0.25)
words = ['Sample1', 'Sample2']
data_start = 0.5
dataSlider_ax = fig.add_axes([0.15, 0.1, 0.7, 0.05])
dataSlider = Slider(dataSlider_ax, 'value', 0, 1, valinit=data_start)
def update(val):
ref = int(dataSlider.val)
print (ref)
ax.imshow(grid[ref], interpolation ='none', aspect = 'auto')
for (j,i),label in np.ndenumerate(grid[ref]):
text = ax.text(i,j,words[ref])
# I uncomment the following line, in case I wanted to plot the values of the arrays
# text = ax.text(i,j,grid[ref][j][i])
dataSlider.on_changed(update)
pyplot.show()