Shouldn't the syntax be:
set tSC=..Adapter.ExecuteProcedure(.ResultSnapshots,.tOutParms,"EXECUTE dbo.spTest(?)",,39)
Nigel Timothy Bloom-Salm
Technical Specialist
Hi All,
Thanks,
Gary
--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.
To post to this group, send email to Ensemble-in...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
How is your stored procedure defined? That may help in working out what the syntax should be. Does it take any arguments? Or does it just return some resultsets?
Dale
________________________________________
From: ensemble-in...@googlegroups.com [ensemble-in...@googlegroups.com] On Behalf Of Gary [fail...@googlemail.com]
Sent: 25 May 2011 10:07 AM
To: InterSystems: Ensemble in Healthcare
Subject: [InterSystems-EnsHlth] Re: Execute a SQL Stored Procedure
You may or may not be doing anything wrong in ObjectScript. The real trouble here is that things are complicated by the way the SQL adapter uses ODBC to pass arguments to your stored procedure, and the way your stored procedure and associated ODBC drivers expect the arguments to be passed. If I know what the definition of the stored procedure is in the target database, at least in terms of arguments and return values, I may be able to suggest a query that is slightly "better", both in terms of what the target database (and drivers) prefer, and what the SQL adapter prefers.
My guess is that you may want to start by trying CALL instead of execute (according to this MSDN site, SQL Server has an explicit preference for CALL syntax: http://msdn.microsoft.com/en-us/library/aa198007%28v=sql.80%29.aspx).
Did you have any luck trying either of the following?
= No arguments format
CALL dbo.spTest
= Single argument format
CALL dbo.spTest(?)
I hope that helps,
Dale
________________________________________
From: ensemble-in...@googlegroups.com [ensemble-in...@googlegroups.com] On Behalf Of Gary [fail...@googlemail.com]
Sent: 25 May 2011 10:14 AM
Class User.DemographicsOperation Extends Ens.BusinessOperation [ ProcedureBlock ]
{
Parameter ADAPTER = "EnsLib.SQL.OutboundAdapter";
Parameter INVOCATION = "Queue";
Method UpdateCDWDemographics(pRequest As User.DemographicsRequest, Output pResponse As User.DemographicsResponse) As %Status
{
set tSC=$$$OK,$ztrap="Error"
// Set Auto Commit to True
set tSC=..Adapter.SetAutoCommit(1)
set pResponse=##class(User.DemographicsResponse).%New()
if pResponse=$$$NULLOREF $$$LOGERROR("CDW Demographics: Unable to Create Response Message") goto End
set tQuery="{ call PACK_LOAD_STAGE.PROC_INS_DEMO(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) }"
set p(1)=pRequest.LabNumber,p(2)=pRequest.PatientName,p(3)=pRequest.PatientAddress1,p(4)=pRequest.PatientAddress2,p(5)=pRequest.PatientAddress3
set p(6)=pRequest.PatientAddress4,p(7)=pRequest.PatientPostCode,p(8)=pRequest.PatientTelephoneNumber,p(9)=pRequest.AuthorizationNumber
set p(10)=pRequest.HospitalId,p(11)=pRequest.NationalId,p(12)=pRequest.Nationality,p(13)=pRequest.SpecimenReferenceNumber,p(14)=pRequest.BirthDate
set p(15)=+pRequest.AgeYears, p(16)=pRequest.AgeMonths, p(17)=pRequest.AgeDays
set p(18)=pRequest.AgeStatus,p(19)=pRequest.Sex,p(20)=pRequest.Race,p(21)=pRequest.Location,p(22)=pRequest.Ward,p(23)=pRequest.HealthCareRegion,p(24)=pRequest.OracleRegion,p(25)=pRequest.SpecimenTypeCode
set p(26)=pRequest.ClinicalDiagnosisCode,p(27)=pRequest.ICD10Code,p(28)=pRequest.Infectious,p(29)=pRequest.Therapy,p(30)=pRequest.Priority
set p(31)=pRequest.PhlebotomistCode,p(32)=pRequest.Note,p(33)=pRequest.TakenDate,p(34)=pRequest.RegisteredDate,p(35)=pRequest.RegisteredBy
set p(36)=pRequest.ModifiedDateTime,p(37)=pRequest.ModifiedBy,p(38)=pRequest.FirstPrintedDate,p(39)=pRequest.ReferringDrCode,p(40)=pRequest.ReferringDrName
set p(41)=pRequest.BillableAccountNumber,p(42)=pRequest.MedialAid,p(43)=pRequest.MedicalAidNumber,p(44)=pRequest.FinancialClass
set p(45)=pRequest.InOutPatient,p(46)=pRequest.AdmissionDate,p(47)=pRequest.VisitNumber,p(48)=pRequest.RepositoryRegdataDate
// Now call the Adapter
set p=48
set tSC=..Adapter.ExecuteProcedureParmArray(.pResultSnapshots,.pOutParam,tQuery,"*",.p)
if +$g(p(49)) {
set pResponse.Success=0,pResponse.ErrorMessage="CDW Demographics: Update Error: SQL Code: "_p(49)
}
elseif 'tSC {
set pResponse.Success=0,pResponse.ErrorMessage="CDW Demographics: Update Error: "_$system.Status.GetErrorText(tSC)
}
else {
set pResponse.Success=1,pResponse.ErrorMessage=""
}
End ;
quit tSC
Error ;
set $ztrap=""
set tSC=$system.Status.Error(5001,"CDW Demographics: Update Error: "_$ze)
goto End
}
XData MessageMap
{
<MapItems>
<MapItem MessageType="User.DemographicsRequest">
<Method>UpdateCDWDemographics</Method>
</MapItem>
</MapItems>