这个Oracle存储proc调用有什么问题?

时间:2019-05-09 09:33:59

标签: oracle stored-procedures

我有一个签名为proc的存储过程:

import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
from pyqtgraph.Point import Point

pg.setConfigOption('background', '#ffffff')
pg.setConfigOption('foreground', 'k')
pg.setConfigOptions(antialias=True)  

app = QtGui.QApplication([])
win = pg.GraphicsWindow()
win.setWindowTitle('pyqtgraph example: crosshair')
label = pg.LabelItem(justify='right')
win.addItem(label)
p1 = win.addPlot(row=1, col=0)       

p1.setAutoVisible(y=True)

#create numpy arrays
#make the numbers large to show that the xrange shows data from 10000 to all the way 0
data1 = 10000 + 15000 * pg.gaussianFilter(np.random.random(size=10000), 10) + 3000 * np.random.random(size=10000)

p1.plot(data1, pen="r")

#cross hair
vLine = pg.InfiniteLine(angle=90, movable=False)
hLine = pg.InfiniteLine(angle=0, movable=False)
p1.addItem(vLine, ignoreBounds=True)
p1.addItem(hLine, ignoreBounds=True)

vb = p1.vb 

print(p1)
print(vb)

def mouseMoved(evt):
    pos = evt[0]  ## using signal proxy turns original arguments into a tuple
    if p1.sceneBoundingRect().contains(pos):
        mousePoint = vb.mapSceneToView(pos)
        index = int(mousePoint.x())
        if index > 0 and index < len(data1):
            label.setText("<span style='font-size: 12pt'>x=%0.1f,   <span style='color: green'>y2=%0.1f</span>" % (mousePoint.x(), data1[index]))
        vLine.setPos(mousePoint.x())
        hLine.setPos(mousePoint.y())

proxy = pg.SignalProxy(p1.scene().sigMouseMoved, rateLimit=60, slot=mouseMoved)
#p1.scene().sigMouseMoved.connect(mouseMoved)

## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()

当我尝试调用它时,在SQL Developer中如下所示:

PROCEDURE contract_boq_import(i_project_id IN RAW, i_master_list_version IN NUMBER,
                             i_force_update_if_exists IN BOOLEAN, i_user_id IN NUMBER)

我收到以下错误:

exec PA_PRJ_IMP.contract_boq_import('B3F4C5933008B348B753F95AA99B3678', 3, 1, 3920)

我可能做错了什么?

2 个答案:

答案 0 :(得分:2)

这是因为'B3F4C5933008B348B753F95AA99B3678'varchar值,而不是RAW值。

您需要在通话中将其转换为RAW。此外,您需要为第三个参数传递布尔值-1是一个数字。

exec PA_PRJ_IMP.contract_boq_import(hextoraw('B3F4C5933008B348B753F95AA99B3678'), 3, true, 3920);

答案 1 :(得分:2)

错误是因为当您期望数字BOOLEAN时传递数字1;在这些数据类型之间没有隐式转换:

exec PA_PRJ_IMP.contract_boq_import('B3F4C5933008B348B753F95AA99B3678', 3, 1, 3920);

PLS-00306: wrong number or types of arguments in call to 'CONTRACT_BOQ_IMPORT'

将其更改为TRUE(或FALSE)即可:

exec PA_PRJ_IMP.contract_boq_import('B3F4C5933008B348B753F95AA99B3678', 3, TRUE, 3920);

PL/SQL procedure successfully completed.

但是您可能也想将第一个参数显式转换为RAW;它将被隐式转换,但最好是显式的:

exec PA_PRJ_IMP.contract_boq_import(hextoraw('B3F4C5933008B348B753F95AA99B3678'), 3, TRUE, 3920);

PL/SQL procedure successfully completed.

快速db<>fiddle,包括表明发生了隐式转换(在第二次调用中)。