Oracle
 sql >> Teknologi Basis Data >  >> RDS >> Oracle

Kesalahan Keluaran Fiddle SQL

Anda perlu meniru dbms_output.put_line :)

Skema:

create table Employee(
  name varchar2(100),
  id integer, 
  salary integer,
  PRIMARY KEY(id)
);

insert into Employee(name,id,salary) values('sa',94,100);
insert into Employee(name,id,salary) values('pr',88,150);
insert into Employee(name,id,salary) values('ji',33,900);
insert into Employee(name,id,salary) values('na',24,880);
insert into Employee(name,id,salary) values('po',65,770);
insert into Employee(name,id,salary) values('ri',69,910);
insert into Employee(name,id,salary) values('uj',12,650);
insert into Employee(name,id,salary) values('ad',43,440);
insert into Employee(name,id,salary) values('sam',40,550);

create table dbmsoutput (
  pos int,
  mes varchar2(4000)
);

SQL:

DECLARE
  employee_record Employee%ROWTYPE;
  procedure put_line(p_mes in varchar2) is
     v_pos int; 
  begin  
     select count(0) into v_pos from dbmsoutput;  
     insert into dbmsoutput (pos, mes) values (v_pos, p_mes);
  end;
BEGIN
 put_line('Hello!  This code is powered by dbms_output emulator :)');
 -- Your code here:
 select * into employee_record from Employee where id>90;
 put_line(employee_record.name||' '||employee_record.id||' '||employee_record.salary);
 --
 put_line('Bye!');
END;
/


SELECT mes FROM dbmsoutput order by pos

biola



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Bisakah kita memperbarui nilai kunci utama dari sebuah tabel?

  2. Bagaimana memperlakukan MAX() dari tabel kosong sebagai 0 alih-alih NULL

  3. Memeriksa apakah suatu item tidak ada di tabel lain

  4. Memperkenalkan Easysoft Oracle® Driver ke dalam Lingkungan SOA Anda

  5. Prosedur Tersimpan SQL Server dari Oracle®