Question Louie McLaughlin · Mar 6, 2023

I need a stored procedure where I can execute multiple delete from statements. 

This will work to create a stored procedure, but when I add in other delete from, get error invalid sql statements when try to create

CREATE PROCEDURE DeleteSpecimenTwo
  (IN Specno VARCHAR(50))
BEGIN
DELETE FROM PCONT WHERE PSPECNO = :Specno;
END;

This doesn't work

CREATE PROCEDURE DeleteSpecimenTwo
  (IN Specno VARCHAR(50))
BEGIN
DELETE FROM PCONT WHERE PSPECNO = :Specno;

DELETE FROM PSPEC WHERE PSPECNO = :Specno;
END;

Any suggestions

Thanks

Louie

1
0 290
Question Louie McLaughlin · Mar 10, 2022

I'm new to cache, come from an oracle and sql server background. In oracle and sql server I could write basically a stored procedure like script and pass it in as text to the command to execute. 

Example:

Below would be the _sqltext

DECLARE @Id INT;

select id into @Id from something;

 if @Id = 9 

BEGIN

do something

END

The _sqltext would work in sql server, what would be the equivalent for cache for it work?

I get a generic error when I try it with cache

using (var mdscmd = new CacheCommand(_sqlText, MyConnection) { CommandType = CommandType.Text }) {

}

Thanks

2
0 262