declare @order int
select @order=max(orderid)+1 from test
这个语句翻译成oracle数据库是怎么样的??谢谢!

解决方案 »

  1.   

    Declare order number(30):=0;
    select max(orderid) as maxvalue order into  from test
      

  2.   

    Declare order number(30):=0; 
    select max(orderid) as maxvalue into order from test;一楼写错了
      

  3.   

    select mpath as vmpath into V_MPATH,(orderid+1) as maxorderid into V_ORDERID,(depth+1) as maxdepth into V_DEPTH from test where classid=V_PARENTID;那我这个语句有什么错误??在pl/sql里面提示未找到要求的from关键字
      

  4.   

    select mpath into V_MPATH,orderid into V_ORDERID from test where classid=V_PARENTID; 
      

  5.   

    declare
       order Integer;
    begin
       select max(orderid)+1 into order from test
    endselect mpath,(orderid+1),(depth+1) into V_MPATH,V_ORDERID,V_DEPTH from test where classid=V_PARENTID; 
      

  6.   

    as into 太多
    select mpath into V_MPATH,(orderid+1) into V_ORDERID,(depth+1) into V_DEPTH from test where classid=V_PARENTID; 
      

  7.   

    好像都不行哦。不好意思我是才开始使用oracle。我将存储过程贴上来,能帮我看看吗??
    CREATE OR REPLACE PROCEDURE "ASPXCLASS_ADD" (
      V_Classname in varchar, 
      V_ORDERID in number, 
      V_PARENTID in number, 
      V_MPATH in VARCHAR2, 
      V_CHILD in NUMBER, 
      V_TYPEDIR in VARCHAR2, 
      V_META in VARCHAR2, 
      V_DEFAULTNAME in VARCHAR2, 
      V_TMPINDEX in VARCHAR2, 
      V_TMPARTICLE in VARCHAR2, 
      V_TMPIMAGES in VARCHAR2, 
      V_ARTICLENAMERULE in VARCHAR2, 
      V_CONTENT in VARCHAR2, 
      V_PAGESIZE in NUMBER, 
      V_POSPAGE in NUMBER, 
      V_POSNEWSID in NUMBER, 
      V_DOMAINS in VARCHAR2, 
      V_FILETIME in NUMBER, 
      V_ADDER in NUMBER, 
      V_ARTICLENUM in NUMBER, 
      V_DEPTH in NUMBER, 
      V_CONTENTTYPE in NUMBER, 
      V_URL in NVARCHAR2, 
      V_TMPLIST in VARCHAR2, 
      V_IMGARTICLENUM in NUMBER, 
      V_AUTOPUBLISH in NUMBER 

    as 
    begin
    --declare V_tmpsql varchar;
    if V_PARENTID <>0 then
    --begin
    -- V_MPATH := select mpath from Aspxclass where classid= V_PARENTID;
    --select mpath into V_MPATH from AspxClass
     --select mpath as vmpath into V_MPATH,(orderid+1) as maxorderid into V_ORDERID,(depth+1) as maxdepth into V_DEPTH from Aspxclass where classid=V_PARENTID;
     --select mpath,(orderid+1),(depth+1) into V_MPATH,V_ORDERID,V_DEPTH from Aspxclass where classid=V_PARENTID; 
     --select mpath into V_MPATH from Aspxclass where classid=V_PARENTID; 
     --select mpath into V_MPATH,orderid into V_ORDERID from Aspxclass where classid=V_PARENTID; 
     --select max(orderid)+1 as V_ORDERID from Aspxclass where classid in (select classid from Aspxclass where classid=V_PARENTID or parentid=V_PARENTID);
    --end
    select orderid into V_ORDERID from Aspxclass;else
     select orderid into V_ORDERID from Aspxclass;
    end if;
    update Aspxclass set orderid=orderid+1 where orderid>=V_ORDERID;
    INSERT INTO Aspxclass( 
    Classname,ORDERID,PARENTID,MPATH,CHILD,TYPEDIR,META,DEFAULTNAME,TMPINDEX,TMPARTICLE,TMPIMAGES,ARTICLENAMERULE,CONTENT,PAGESIZE,POSPAGE,POSNEWSID,DOMAINS,FILETIME,ADDER,ARTICLENUM,DEPTH,CONTENTTYPE,URL,TMPLIST,IMGARTICLENUM,AUTOPUBLISH)VALUES( 
    V_Classname,V_ORDERID,V_PARENTID,V_MPATH,V_CHILD,V_TYPEDIR,V_META,V_DEFAULTNAME,V_TMPINDEX,V_TMPARTICLE,V_TMPIMAGES,V_ARTICLENAMERULE,V_CONTENT,V_PAGESIZE,V_POSPAGE,V_POSNEWSID,V_DOMAINS,V_FILETIME,V_ADDER,V_ARTICLENUM,V_DEPTH,V_CONTENTTYPE,V_URL,V_TMPLIST,V_IMGARTICLENUM,V_AUTOPUBLISH 
    );
    end;
      

  8.   

    SELECT MPATH, (ORDERID + 1), (DEPTH + 1)
      INTO V_MPATH, V_ORDERID, V_DEPTH
      FROM TEST
     WHERE CLASSID = V_PARENTID;
      

  9.   

    语句看不出什么问题,不过if else中的语句没有什么区别,最好捕捉一下异常.
      

  10.   

    v_orderid是输入参数,不允许被修改,所以select ... into v_orderid就错了。