Beruflich Dokumente
Kultur Dokumente
--------------------declare
begin
create table emp_d as select * from emp;
end;
/
============================
dynamic delete statement
============================
set serveroutput on
declare
c_id number;
v_result number;
begin
c_id:=dbms_sql.open_cursor;
dbms_sql.parse(c_id,'delete from '||'&tname',dbms_sql.native);
v_result:=dbms_sql.execute(c_id);
dbms_output.put_line(v_result);
dbms_sql.close_cursor(c_id);
end;
/
============================
dynamic delete statement with exception
============================
declare
c_id number;
v_result number;
begin
c_id:=dbms_sql.open_cursor;
dbms_sql.parse(c_id,'delete from '||'&tname',dbms_sql.native);
v_result:=dbms_sql.execute(c_id);
dbms_output.put_line(v_result);
dbms_sql.close_cursor(c_id);
exception
when others then
dbms_output.put_line(sqlerrm);
end;
/
===============================
native dynamic (execute immediate using only for the single or 1 row output (sel
ect,insert,delete,update))
===============================
set serveroutput on
declare
v_statement varchar2(32767);
begin
v_statement:='delete from '||'&tname';
execute immediate v_statement;
exception
when others then
dbms_output.put_line(sqlerrm);
end;
/
contents := UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(file));
DBMS_LOB.CLOSE(file);
RETURN contents;
END;
/
BEGIN
UTL_MAIL.SEND_ATTACH_VARCHAR2(
sender => 'gulzarsk@hotmail.com',
recipients => 'gulzarsk@hotmail.com',
message =>
'<HTML><BODY>See attachment</BODY></HTML>',
subject => 'Oracle Notes',
mime_type => 'text/html',
attachment => get_file('1.txt'),
att_inline => false,
att_mime_type => 'text/plain',
att_filename => '1.txt');
END;
/
CREATE OR REPLACE FUNCTION scott.get_image(filename VARCHAR2, dir VARCHAR2 := 'D
_TEMP')
RETURN RAW IS
image RAW(32767);
file BFILE := BFILENAME(dir, filename);
BEGIN
DBMS_LOB.FILEOPEN(file, DBMS_LOB.FILE_READONLY);
image := DBMS_LOB.SUBSTR(file);
DBMS_LOB.CLOSE(file);
RETURN image;
END;
/
BEGIN
UTL_MAIL.SEND_ATTACH_RAW(
sender => 'gulzarsk@yahoo.com',
recipients => 'gulzarsk@vsnl.com',
message => '<HTML><BODY>See attachment</BODY></HTML>',
subject => 'MyNotes',
mime_type => 'text/html',
attachment => scott.get_image('spiderman.jpg'),
att_inline => true,
att_filename => 'spiderman.jpg');
END;
/
==================================================================
ed to edit the current/last query
into in select
into in fatch
into in fatch