Этот sql запускается из окна в Sybase, но когда я помещаю его в сохраненный процесс, я получаю сообщение об ошибке при второй вставке
Я пытаюсь выяснить, почему я получаю сообщение об ошибке на второй вставке при выполнении этой хранимой процедуры:
ALTER PROCEDURE "DBA"."sp_holdterms"( /* [IN | OUT | INOUT] parameter_name parameter_type [DEFAULT default_value], ... */ )
/* RESULT( column_name column_type, ... ) */
BEGIN
INSERT INTO "DBA"."ProxReg_Holds"(SELECT "DBA"."ProxReg_IDMaster"."StudNum",
"DBA"."ProxReg_IDMaster"."BirthDate",
"DBA"."ProxReg_IDMaster"."LastName",
"DBA"."ProxReg_IDMaster"."FirstName",
"DBA"."ProxReg_IDMaster"."MiddleName",
CURRENT Date AS "DatePlaced",
"DBA"."HOLD_IMPORT"."HTYPE" AS "OfficeCode",
"DBA"."HOLD_IMPORT"."Term1" AS "TermID",
"DBA"."HOLD_IMPORT"."FLAG ",
1 AS "Forever",
NULL AS "Comments",
'HAT' AS "ChangedBy",
CURRENT Date AS "ChangeDate",
NULL AS "ChangeTime",
CURRENT TimeStamp AS "TimeStamp1"
FROM "DBA"."ProxReg_IDMaster" JOIN "DBA"."HOLD_IMPORT" ON "DBA"."ProxReg_IDMaster"."StudNum" = "DBA"."HOLD_IMPORT"."STUDNUM")
INSERT INTO "DBA"."ProxReg_Holds"(SELECT "DBA"."ProxReg_IDMaster"."StudNum",
"DBA"."ProxReg_IDMaster"."BirthDate",
"DBA"."ProxReg_IDMaster"."LastName",
"DBA"."ProxReg_IDMaster"."FirstName",
"DBA"."ProxReg_IDMaster"."MiddleName",
CURRENT Date AS "DatePlaced",
"DBA"."HOLD_IMPORT"."HTYPE" AS "OfficeCode",
"DBA"."HOLD_IMPORT"."Term2" AS "TermID",
"DBA"."HOLD_IMPORT"."FLAG ",
1 AS "Forever",
NULL AS "Comments",
'HAT' AS "ChangedBy",
CURRENT Date AS "ChangeDate",
NULL AS "ChangeTime",
CURRENT TimeStamp AS "TimeStamp1"
FROM "DBA"."ProxReg_IDMaster" JOIN "DBA"."HOLD_IMPORT" ON "DBA"."ProxReg_IDMaster"."StudNum" = "DBA"."HOLD_IMPORT"."STUDNUM")
INSERT INTO "DBA"."ProxReg_Holds"(SELECT "DBA"."ProxReg_IDMaster"."StudNum",
"DBA"."ProxReg_IDMaster"."BirthDate",
"DBA"."ProxReg_IDMaster"."LastName",
"DBA"."ProxReg_IDMaster"."FirstName",
"DBA"."ProxReg_IDMaster"."MiddleName",
CURRENT Date AS "DatePlaced",
"DBA"."HOLD_IMPORT"."HTYPE" AS "OfficeCode",
"DBA"."HOLD_IMPORT"."Term3" AS "TermID",
"DBA"."HOLD_IMPORT"."FLAG ",
1 AS "Forever",
NULL AS "Comments",
'HAT' AS "ChangedBy",
CURRENT Date AS "ChangeDate",
NULL AS "ChangeTime",
CURRENT TimeStamp AS "TimeStamp1"
FROM "DBA"."ProxReg_IDMaster" JOIN "DBA"."HOLD_IMPORT" ON "DBA"."ProxReg_IDMaster"."StudNum" = "DBA"."HOLD_IMPORT"."STUDNUM")
INSERT INTO "DBA"."ProxReg_Holds"(SELECT "DBA"."ProxReg_IDMaster"."StudNum",
"DBA"."ProxReg_IDMaster"."BirthDate",
"DBA"."ProxReg_IDMaster"."LastName",
"DBA"."ProxReg_IDMaster"."FirstName",
"DBA"."ProxReg_IDMaster"."MiddleName",
CURRENT Date AS "DatePlaced",
"DBA"."HOLD_IMPORT"."HTYPE" AS "OfficeCode",
"DBA"."HOLD_IMPORT"."Term4" AS "TermID",
"DBA"."HOLD_IMPORT"."FLAG ",
1 AS "Forever",
NULL AS "Comments",
'HAT' AS "ChangedBy",
CURRENT Date AS "ChangeDate",
NULL AS "ChangeTime",
CURRENT TimeStamp AS "TimeStamp1"
FROM "DBA"."ProxReg_IDMaster" JOIN "DBA"."HOLD_IMPORT" ON "DBA"."ProxReg_IDMaster"."StudNum" = "DBA"."HOLD_IMPORT"."STUDNUM")
INSERT INTO "DBA"."ProxReg_Holds"(SELECT "DBA"."ProxReg_IDMaster"."StudNum",
"DBA"."ProxReg_IDMaster"."BirthDate",
"DBA"."ProxReg_IDMaster"."LastName",
"DBA"."ProxReg_IDMaster"."FirstName",
"DBA"."ProxReg_IDMaster"."MiddleName",
CURRENT Date AS "DatePlaced",
"DBA"."HOLD_IMPORT"."HTYPE" AS "OfficeCode",
"DBA"."HOLD_IMPORT"."Term5" AS "TermID",
"DBA"."HOLD_IMPORT"."FLAG ",
1 AS "Forever",
NULL AS "Comments",
'HAT' AS "ChangedBy",
CURRENT Date AS "ChangeDate",
NULL AS "ChangeTime",
CURRENT TimeStamp AS "TimeStamp1"
FROM "DBA"."ProxReg_IDMaster" JOIN "DBA"."HOLD_IMPORT" ON "DBA"."ProxReg_IDMaster"."StudNum" = "DBA"."HOLD_IMPORT"."STUDNUM")
END
Работает нормально из окна в Sybase. Что может Sybase делать иначе, чем хранимая процедура?
Если это будет полезно, я могу опубликовать пример ошибки, которую я получаю, когда запускаю ее как хранимую процедуру.
1 ответ
Попробуйте обновить заявление в правильном формате. Снять скобки перед оператором выбора и после оператора выбора
вставить в databasename.Schema.TableName select ('ABC','ABC',9);