上面查询语句写错了, 应该是 select * from table—name where id=@id
declare id varchar2(20) := '1234'; temp table—name%ROWTYPE; begin select * into temp from table—name where id = id; end;
declare @id varchar2(20); set @id='1234' select * from where id=@id 在oracle中使用如下: declare id varchar2(20) := '1234 '; begin select * from table_name where id=id; exception when others then DBMS_OUTPUT.PUT_LINE('错误'); end ;
declare id varchar2(20) := '1234 '; begin select * from table_name where id=id; exception when others then DBMS_OUTPUT.PUT_LINE('错误'); end ;就是这样写就好啦
没学过Oracle呢? 暂时在学习SQL Server 2000呢,学完了之后再学Oracle
只学了 SQL Server 2000.还没学Oracle.
在oracle 10g中使用如下: declare @id varchar2(20):='1234'; begin select * from where id=@id; exception when others then DBMS_OUTPUT.PUT_LINE('错误'); end;
declare sid varchar2(20); begin sid:='1234'; select * from tableName where id =sid; end
declare id varchar2(20) := '1234 '; begin select * from table_name where id=id; exception when others then DBMS_OUTPUT.PUT_LINE('错误'); end ; 就是这样写就好啦
declare id varchar2(20) ; Type v_cursor is ref cursor; m_cursor v_cursor; m_temp table_name%rowtype; begin id:='1234'; open m_cursor for select * from table_name where id=id; loop fetch m_cursor into m_temp; exit when m_cursor%notfound; dbms_output.put_line(m_temp); end loop; exception when others then DBMS_OUTPUT.PUT_LINE('错误'); end ;
declare
id varchar2(20) := '1234';
temp table—name%ROWTYPE;
begin
select * into temp from table—name where id = id;
end;
set @id='1234'
select * from where id=@id
在oracle中使用如下:
declare
id varchar2(20) := '1234 ';
begin
select * from table_name where id=id;
exception
when others then
DBMS_OUTPUT.PUT_LINE('错误');
end ;
id varchar2(20) := '1234 ';
begin
select * from table_name where id=id;
exception
when others then
DBMS_OUTPUT.PUT_LINE('错误');
end ;就是这样写就好啦
暂时在学习SQL Server 2000呢,学完了之后再学Oracle
@id varchar2(20):='1234';
begin
select * from where id=@id;
exception
when others then
DBMS_OUTPUT.PUT_LINE('错误');
end;
sid varchar2(20);
begin
sid:='1234';
select * from tableName where id =sid;
end
id varchar2(20) := '1234 ';
begin
select * from table_name where id=id;
exception
when others then
DBMS_OUTPUT.PUT_LINE('错误');
end ;
就是这样写就好啦
id varchar2(20) ;
Type v_cursor is ref cursor;
m_cursor v_cursor;
m_temp table_name%rowtype;
begin
id:='1234';
open m_cursor for select * from table_name where id=id;
loop
fetch m_cursor into m_temp;
exit when m_cursor%notfound;
dbms_output.put_line(m_temp);
end loop;
exception
when others then
DBMS_OUTPUT.PUT_LINE('错误');
end ;