请教一个过程的写法
原写法如下:create or replace procedure 
  p_ModPass(uCardID varchar2)
   as
 begin
       select pass,isReportLoss into pass,isLoss from CardInfo where CardID = uCardID; 
 end我现在想把 CardID = uCardID; 变成一个参数传进去。请问该如何写:
如果在SQL里应该是这样写。
CREATE PROC P_NAME(
 uCardID  NVARCHAR(24)
AS
BEGIN
 EXEC(' select pass,isReportLoss into pass,isLoss from CardInfo where '+ uCardID  )
END

解决方案 »

  1.   

    CREATE PROC P_NAME(
    uCardID  NVARCHAR(24)
    AS
    BEGIN
    EXEC(' select pass,isReportLoss from CardInfo where '+ uCardID  ) into pass,isLoss
    END
      

  2.   

    CREATE OR REPLACE PROCEDURE (UCARDID IN STRING) IS
    BEGIN
      EXEC(' select pass,isReportLoss from CardInfo where ' + UCARDID)
        INTO PASS, ISLOSS;
    END;
      

  3.   

    CREATE OR REPLACE PROCEDURE (UCARDID IN STRING) IS 
    BEGIN 
      execute immediate ' select pass,isReportLoss from CardInfo where ' || UCARDID INTO PASS, ISLOSS; 
      dbms_output.put_line(pass);
    END;
    oracle中的串连接是||,而不是+