델파이의 코딩으로
실행중 sp 의 생성 방법 좀..
아무리 해도 되지 않습니다.
SQL.Add( 하고 execsql했습니다.
SET TERM ^ ; //이건 에러나서 빼고 했는데도, unknown token ?. 에러납니다.
/* Stored procedures */
CREATE PROCEDURE "PROC_SC1"
(
S1TBL VARCHAR(10)
)
RETURNS
(
XCCODE VARCHAR(16),
XSLP DOUBLE PRECISION,
XMISU DOUBLE PRECISION,
XPOINT DOUBLE PRECISION,
XTOT_VISIT DOUBLE PRECISION
)
AS
BEGIN EXIT; END ^
ALTER PROCEDURE "PROC_SC1"
(
S1TBL VARCHAR(10)
)
RETURNS
(
XCCODE VARCHAR(16),
XSLP DOUBLE PRECISION,
XMISU DOUBLE PRECISION,
XPOINT DOUBLE PRECISION,
XTOT_VISIT DOUBLE PRECISION
)
AS
BEGIN
for select CCODE,
c.SELLPRICE+ sum(CASH)+sum(CARDPRICE)+sum(CHECKPRICE)+sum(TAX)+sum(INMISUPRICE) as SLP,
c.MISU+ sum(CREDITPRICE)-sum(INMISUPRICE) as MISU,
c.POINT+ sum(TODAYPOINT)-sum(POINTUSEPRICE) as TOT_POINT,
c.VISITTIMES+count(*) as TOT_VISIT
from S11999 s
inner join CLIENT c on (s.CCODE=c.CODE)
group by s.CCODE,c.SELLPRICE, c.MISU,c.POINT,c.VISITTIMES
INTO :XCCODE, :XSLP, :XMISU, :XPOINT, :XTOT_VISIT
DO BEGIN
update CLIENT
set SELLPRICE= :XSLP, MISU= :XMISU, POINT= :XPOINT, VISITTIMES= :XTOT_VISIT
where CLIENT.CODE= :XCCODE;
SUSPEND;
END
END
^
SET TERM ; ^
> 델파이의 코딩으로
> 실행중 sp 의 생성 방법 좀..
> 아무리 해도 되지 않습니다.
>
> SQL.Add( 하고 execsql했습니다.
>
> SET TERM ^ ; //이건 에러나서 빼고 했는데도, unknown token ?. 에러납니다.
>
>
> /* Stored procedures */
>
> CREATE PROCEDURE "PROC_SC1"
> (
> S1TBL VARCHAR(10)
> )
> RETURNS
> (
> XCCODE VARCHAR(16),
> XSLP DOUBLE PRECISION,
> XMISU DOUBLE PRECISION,
> XPOINT DOUBLE PRECISION,
> XTOT_VISIT DOUBLE PRECISION
> )
> AS
> BEGIN EXIT; END ^
>
>
> ALTER PROCEDURE "PROC_SC1"
> (
> S1TBL VARCHAR(10)
> )
> RETURNS
> (
> XCCODE VARCHAR(16),
> XSLP DOUBLE PRECISION,
> XMISU DOUBLE PRECISION,
> XPOINT DOUBLE PRECISION,
> XTOT_VISIT DOUBLE PRECISION
> )
> AS
>
> BEGIN
>
> for select CCODE,
> c.SELLPRICE+ sum(CASH)+sum(CARDPRICE)+sum(CHECKPRICE)+sum(TAX)+sum(INMISUPRICE) as SLP,
> c.MISU+ sum(CREDITPRICE)-sum(INMISUPRICE) as MISU,
> c.POINT+ sum(TODAYPOINT)-sum(POINTUSEPRICE) as TOT_POINT,
> c.VISITTIMES+count(*) as TOT_VISIT
> from S11999 s
> inner join CLIENT c on (s.CCODE=c.CODE)
> group by s.CCODE,c.SELLPRICE, c.MISU,c.POINT,c.VISITTIMES
> INTO :XCCODE, :XSLP, :XMISU, :XPOINT, :XTOT_VISIT
>
> DO BEGIN
> update CLIENT
> set SELLPRICE= :XSLP, MISU= :XMISU, POINT= :XPOINT, VISITTIMES= :XTOT_VISIT
> where CLIENT.CODE= :XCCODE;
> SUSPEND;
> END
> END
> ^
>
> SET TERM ; ^
>
제가 실제로 소스에서 코딩한 내용입니다.
참고하세요...
with Query1 do
begin
close;
sql.add('CREATE PROCEDURE UPDATE_PERSON4 ');
sql.add('(PCHART VARCHAR(13)) AS BEGIN ');
sql.add('UPDATE PERSON SET P_JUMIN = "101010-2010236"');
SQL.ADD('WHERE P_CHART LIKE "%10" ;');
sql.add('END');
Execsql;
end;