我想从Excel中的查询窗口运行此代码,但在完成第一个语句后出现错误。如果可以在PCC中正常运行。我假设我需要使用变量创建存储过程。 Parent ='B-8579-K'是变量值。
调用是否可以在Excel中运行而不会导致错误?
delete z_Expl_BOM_Temp;
insert into z_Expl_BOM_Temp
select
Parent, L1_Child_Seq, L1_Child, L1_Child_QTY,
L2_Child_Seq, L2_Child, L2_Child_QTY,
L3_Child_Seq, L3_Child, L3_Child_QTY,
L4_Child_Seq, L4_Child, L4_Child_QTY,
L5_Child_Seq, L5_Child, L5_Child_QTY
from
EGC_Expl_BOM_TT
where
Parent = 'B-8579-K' ;
答案 0 :(得分:0)
在Pervasive中创建存储过程记录here 获取参数的存储过程的示例是:
CREATE PROCEDURE Checkmax(in :classid integer);
BEGIN
DECLARE :numenrolled integer;
DECLARE :maxenrolled integer;
SELECT COUNT(*) INTO :numenrolled FROM Enrolls WHERE class_ID = :classid;
SELECT Max_size INTO :maxenrolled FROM Class WHERE id = :classid;
IF (:numenrolled >= :maxenrolled) THEN
PRINT 'Enrollment Failed. Number of students enrolled reached maximum allowed for this class' ;
ELSE
PRINT 'Enrollment Possible. Number of students enrolled has not reached maximum allowed for this class';
END IF;
END;
然后称之为:
CALL Checkmax(101)
答案 1 :(得分:0)
我终于在没有错误的情况下创建了SP:
function convert_to_true()
{
sed -i 's/overviewfalse/overviewtrue/' abcd.txt
for iterator in `seq 1 10`; do
match=part${iterator}false
replace=part${iterator}true
command="sed -i 's/${match}/${replace}/' abcd.txt"
echo $command
$(command)
done
}
我可以打电话给PCC就好了。但是,当我在Excel中运行CALL时,查询窗口将执行该过程,但是当它完成时我会收到此错误:
"查询未运行,或者无法打开数据库表。 检查数据库服务器或联系数据库管理员。确保外部数据库可用且尚未移动或重组,然后再次尝试操作。"
现在可能会变成VBA问题。我可以用VBA运行CALL吗?