如何在循环pl / sql中重复select语句?

时间:2017-04-21 10:07:30

标签: sql plsql

我想从我的表中选择列suspend_account上的'N'行,以填充下面的表单字段。我的表单有更多字段,但我只是将其中一个放在那里。任何帮助,将不胜感激。这是在pl / sql中,我正在使用toad for oracle。

- 选择声明 -

SELECT 
        SZRUNSP_STUDENT_NO,     
        SZRUNSP_STUDENT_NAME, 
        SZRUNSP_SUSPEND_ACCOUNT, 
        SZRUNSP_UNSUSPEND_DATE 

    INTO v_stu_id, 
         v_stu_name, 
         v_sus_account, 
         v_unsus_date 
        FROM SATURN.SZRUNSP
    WHERE SZRUNSP_SUSPEND_ACCOUNT = ('N')
    ORDER BY SZRUNSP_UNSUSPEND_DATE ASC;

- 表单字段 -

twbkfrmt.p_TableDataWhite (HTF.formtext (
                                    cname        => '',
                                    csize        => 15,
                                    cmaxlength   => 9,
                                    cvalue       => v_stu_id,
                                    cattributes  => 'style="font-size:12px" readonly ' || disabled))

1 个答案:

答案 0 :(得分:1)

我很确定,这就是你所需要的。这里需要一个游标,因为你需要一个循环来获取所有Suspend_Account ='N'

的学生
import cv2
import numpy as np

SZ=20
bin_n = 16 # Number of bins

svm_params = dict( kernel_type = cv2.SVM_LINEAR,
                    svm_type = cv2.SVM_C_SVC,
                    C=2.67, gamma=5.383 )

affine_flags = cv2.WARP_INVERSE_MAP|cv2.INTER_LINEAR

def deskew(img):
    m = cv2.moments(img)
    if abs(m['mu02']) < 1e-2:
        return img.copy()
    skew = m['mu11']/m['mu02']
    M = np.float32([[1, skew, -0.5*SZ*skew], [0, 1, 0]])
    img = cv2.warpAffine(img,M,(SZ, SZ),flags=affine_flags)
    return img

def hog(img):
    gx = cv2.Sobel(img, cv2.CV_32F, 1, 0)
    gy = cv2.Sobel(img, cv2.CV_32F, 0, 1)
    mag, ang = cv2.cartToPolar(gx, gy)
    bins = np.int32(bin_n*ang/(2*np.pi))    # quantizing binvalues in (0...16)
    bin_cells = bins[:10,:10], bins[10:,:10], bins[:10,10:], bins[10:,10:]
    mag_cells = mag[:10,:10], mag[10:,:10], mag[:10,10:], mag[10:,10:]
    hists = [np.bincount(b.ravel(), m.ravel(), bin_n) for b, m in zip(bin_cells, mag_cells)]
    hist = np.hstack(hists)     # hist is a 64 bit vector
    return hist

img = cv2.imread('digits.png',0)

cells = [np.hsplit(row,100) for row in np.vsplit(img,50)]

# First half is trainData, remaining is testData
train_cells = [ i[:50] for i in cells ]
test_cells = [ i[50:] for i in cells]

######     Now training      ########################

deskewed = [map(deskew,row) for row in train_cells]
hogdata = [map(hog,row) for row in deskewed]
trainData = np.float32(hogdata).reshape(-1,64)
responses = np.float32(np.repeat(np.arange(10),250)[:,np.newaxis])

svm = cv2.SVM()
svm.train(trainData,responses, params=svm_params)
svm.save('svm_data.dat')

######     Now testing      ########################

deskewed = [map(deskew,row) for row in test_cells]
hogdata = [map(hog,row) for row in deskewed]
testData = np.float32(hogdata).reshape(-1,bin_n*4)
result = svm.predict_all(testData)

#######   Check Accuracy   ########################
mask = result==responses
correct = np.count_nonzero(mask)
print correct*100.0/result.size