Compile procedures
Hi All,
I am using oracle 10.2.
i am new to procedures.
i created procedure.
That procedure created with some errors.
i got message as Warning: Procedure created with compilation errors.
i want to know where is the error. so i want to compile it. where i can compile the procedure?
which option i can use?
thanks
To show the errors, either
- immediately type 'SHOW ERRORS' after you receive the error message
- or issue 'select * from user_errors where name='<name of procedure in error>'
To compile a procedure
alter procedure <procedurename> compile;
Sybrand Bakker
Senior Oracle DBA
Similar Messages
-
Problem in compiling procedure from another schema
Hi all
I have got 2 schemas, say A and B.
Schema A owns a procedure P which selects data from table T1 ( external table ) and updates table T2.
i have granted Schema B
1) read, write privilege on the directory that table T1 refrences.
2) all on table T1
3) all on table T2
4) execute on P
I have created public synonyms for T1, T2 and P ( same name ).
Now when i try to compile procedure P from schema B I get error
ORA-01031: insufficient privileges
Where am i wrong?
Please HelpYou'll need CREATE ANY PROCEDURE privilege for that.
Is there any reason why you don't post the one thing on which you are asking about : the alter procedure statement?
(apart from also not posting the version, which you always should include)
Sybrand Bakker
Senior Oracle DBA -
Compiling Procedures/Packages/Functions
I'm fairly new to the arena of compiling Procedures/Packages/Funcitons but I was given the task of updating a development DB with a lot of newly created/updated Objects. I have created a shell script to go through all the new files and create or replace all the new objects in sqlplus. My question is how to compile all the newly created objects and their dependencies correctly? I have been using SQL Developer to verify that everything has compiled but I see that some are marked invalid which I assume is because a dependency was compiled after it. What would be my best way to making sure everything is valid? I hope this makes sense but any help would be appreciated.
You can use a script like this to build your own sql statement to compile the invalid objects. You can add your own statement for other object types at the end with a union, ie TYPE body.
You will probably need to run it repeated until all objects are VALID. You can put it in a PL/SQL block with a loop and execute immediate so reduce the manual work.
--PACKAGE
select 'alter package ' || object_name || ' compile;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'PACKAGE'
union
-- PACKAGE BODY
select 'alter package ' || object_name || ' compile body;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'PACKAGE BODY'
union
--PROCEDURE
select 'alter procedure ' || object_name || ' compile;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'PROCEDURE'
union
--FUNCTION
select 'alter function ' || object_name || ' compile;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'FUNCTION'
union
--TRIGGER
select 'alter trigger ' || object_name || ' compile;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'TRIGGER'
union
--VIEW
select 'alter view ' || object_name || ' compile;' from user_objects
WHERE Status = 'INVALID'
and object_type= 'VIEW' -
Compile procedure on 8.1.7 Win OK - on 9.2.0.4.0 SUN Error
Hi,
I have got a problem with compiling procedure on database 9.2.0.4.0 SUN. This same procedure compile without problems on 8.1.7 Win. Links, hints will be helpful. The procedure and error are below:
CREATE OR REPLACE PROCEDURE BUDZET2003.P_IM_PR_PRZYCH_PE_TMP(USER IN CHAR)
is
BEGIN
insert into IM_PR_PRZYCH_TMP
Select PROJEKTY_ID, PROJEKTY_NAZWA,PROJEKTY_NADRZ_ID,PROJEKTY_OPERATOR,PROJEKTY_FORMULA,'',PROJEKTY_SORT2,
WYDZIAL, ODPOWIEDZIALNY, WAZNY_OD, WAZNY_DO, ZASILANIE, SYSDATE, USER ,''
FROM W2_PR_PRZYCH_EE_C
start with PROJEKTY_id = 'PE'
Connect by prior PROJEKTY_id = PROJEKTY_NADRZ_ID
WHERE
PROJEKTY_ID NOT IN
(SELECT PROJEKTY_ID
FROM W2_PR_PRZYCH)
END;
4/1 PL/SQL: SQL Statement ignored
10/53 PL/SQL: ORA-00907:
Thanks
jozefpHi,
usually I expect people to do a little research and I do not give everything chewed.
Point 4:
go to the
<b>Oracle9i Database Migration Release 2 (9.2)</b>
go to the chapter 3
<b>Upgrading a Database to the New Oracle9i Release</b>
go to the point:
<b>Upgrade the Database Manually</b>
Exactly from here:
http://download.oracle.com/docs/cd/B10501_01/server.920/a96530/upgrade.htm#1009200
Keep in mind
1) that the <i>EXACT </i>procedure you are following it is not indicated in this manual
2) you have to think a little ( do you have all the windows services created on the destination system? if not, you have to create them ... )
3) this procedure is not supported by SAP. It is a valid option but not supported by them. You have to practice until you get all the points correctly -
Security question: Can you decompile a PL/SQL compiled procedure?
I am wondering if anyone would be able to tell me if it is possible to decompile a compiled oracle PL/SQL procedure.
Scenario:
I create some data encryption code in PL/SQL that contains an encryption key string. I compile the PL/SQL as a stored procedure and store that binary object as a BLOB in the database. If a hacker can snag a whole database that would include this BLOB and he figures out that the BLOB might contain the key, can he get access to the key by decompiling somehow the BLOB back into PL/SQL statements?
Thanks in advance!!
Gary Glover, CISSP
[email protected]Gary, when a hacker gets into your database (with sysdba rights), your are pretty much screwed - even with encrypted code and data.
To obtain that level of access, the hacker must be good. And persistant. Thus you can expect that he will compromise the rest of the stuff inside the database.
Alternatively, your database security was shoddy - trying to patch security via encrypting code in the database is a poor second.
It is also a question of time and effort vs. benefits. Spend 80% attempting to secure the code in the database, and 20% securing the database? Or 90% securing the database and 10% securing the code and data in the database? -
Error in Compiling Procedure within a Procedure ?
I am currently using oracle 11g, and I am getting the error when compiling the following procedure.
Please adv, what am I missing?
If a remove the following lines, then procedure is compiled.
BEGIN
BEGIN my_ctx_procedure(MSHOLD_CODE);
END;
Thanks a lot.
Luqman
create or replace PROCEDURE TEST1
(FDATE1 DATE, FDATE2 DATE,MSHOLD_CODE IN VARCHAR)
IS
BEGIN
BEGIN my_ctx_procedure(MSHOLD_CODE);
END;
CURSOR c1 IS
SELECT * from sholders
where SHOLD_CODE IN
(select * from IN_LIST);
BEGIN
OPEN C1;
END TEST1;
ERROR
LINE/COL ERROR
7/8 PLS-00103: Encountered the symbol "C1" when expecting one of the
following:
:= . ( @ % ;What exactly are you trying to do?
run the my_ctx_procedure(MSHOLD_CODE) proc prior to opening the cursor?
If so:
create or replace PROCEDURE TEST1
(FDATE1 DATE, FDATE2 DATE,MSHOLD_CODE IN VARCHAR)
IS
CURSOR c1 IS
SELECT * from sholders
where SHOLD_CODE IN
(select * from IN_LIST);
BEGIN
my_ctx_procedure(MSHOLD_CODE);
OPEN C1;
END TEST1;
/Your error comes because you put BEGIN and then tried to declare a cursor. You can't declare an explicit cursor inside the main bit of the code; you have to do it in the declaration section (ie. the bit between DECLARE / CREATE Procedure ... IS and the BEGIN)
Edited by: Boneist on 10-Jul-2009 11:31
I suggest you read through this: http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/toc.htm to gain a better understanding of PL/SQL -
I have the following procedure that I am trying to complile, logged in as TMMGR:
CREATE OR REPLACE PROCEDURE UPDATE_TMS_LOAD AS
v_err_msg VARCHAR2(150);
CURSOR cur_load IS
SELECT * from tmmgr.load;
BEGIN
FOR load_rec IN cur_load LOOP
BEGIN
INSERT INTO SFITRAN.TMS_LOAD
( ID
, SCHED_NUM
, BILL
, LOCATION_ID
, TRLR_TYPE_ID
, CARRIER_ID
, MILES
, EARLY_DEP
, LATE_DEP
, STATUS
, FREIGHT_COST
, FREIGHT_COST_CUR
, NO_STOP
, BEST_DEP
, WEIGHT
, CUBE
, PCS
, PALLETS
, FREIGHT_NET
, FREIGHT_NET_CUR
, ADJUSTED_COST
, ADJUSTED_COST_CUR
, LINE_ADJUSTED_COST
, LINE_ADJUSTED_COST_CUR
, LAYOVER
, TRIP_END_DATE
, LINEHAUL_COST)
VALUES (load_rec.ID
, load_rec.SCHED_NUM
, load_rec.BILL
, load_rec.LOCATION_ID
, load_rec.TRLR_TYPE_ID
, load_rec.CARRIER_ID
, load_rec.MILES
, load_rec.EARLY_DEP
, load_rec.LATE_DEP
, load_rec.STATUS
, load_rec.FREIGHT_COST
, load_rec.FREIGHT_COST_CUR
, load_rec.NO_STOP
, load_rec.BEST_DEP
, load_rec.WEIGHT
, load_rec.CUBE
, load_rec.PCS
, load_rec.PALLETS
, load_rec.FREIGHT_NET
, load_rec.FREIGHT_NET_CUR
, load_rec.ADJUSTED_COST
, load_rec.ADJUSTED_COST_CUR
, load_rec.LINE_ADJUSTED_COST
, load_rec.LINE_ADJUSTED_COST_CUR
, load_rec.LAYOVER
, load_rec.TRIP_END_DATE
, load_rec.LINEHAUL_COST);
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
-- If the record exist then update it
UPDATE SFITRAN.TMS_LOAD
SET ID = load_rec.ID
, SCHED_NUM = load_rec.SCHED_NUM
, BILL = load_rec.BILL
, LOCATION_ID = load_rec.LOCATION_ID
, TRLR_TYPE_ID = load_rec.TRLR_TYPE_ID
, CARRIER_ID = load_rec.CARRIER_ID
, MILES = load_rec.MILES
, EARLY_DEP = load_rec.EARLY_DEP
, LATE_DEP = load_rec.LATE_DEP
, STATUS = load_rec.STATUS
, FREIGHT_COST = load_rec.FREIGHT_COST
, FREIGHT_COST_CUR = load_rec.FREIGHT_COST_CUR
, NO_STOP = load_rec.NO_STOP
, BEST_DEP = load_rec.BEST_DEP
, WEIGHT = load_rec.WEIGHT
, CUBE = load_rec.CUBE
, PCS = load_rec.PCS
, PALLETS = load_rec.PALLETS
, FREIGHT_NET = load_rec.FREIGHT_NET
, FREIGHT_NET_CUR = load_rec.FREIGHT_NET_CUR
, ADJUSTED_COST = load_rec.ADJUSTED_COST
, ADJUSTED_COST_CUR = load_rec.ADJUSTED_COST_CUR
, LINE_ADJUSTED_COST=load_rec.LINE_ADJUSTED_COST
, LINE_ADJUSTED_COST_CUR
=load_rec.LINE_ADJUSTED_COST_CUR
, LAYOVER = load_rec.LAYOVER
, TRIP_END_DATE = load_rec.TRIP_END_DATE
, LINEHAUL_COST = load_rec.LINEHAUL_COST
WHERE id = load_rec.id
AND sched_num = load_rec.sched_num;
END;
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
v_err_msg := SUBSTR(SQLERRM, 1, 150);
DBMS_OUTPUT.PUT_LINE(v_err_msg);
END UPDATE_TMS_LOAD;
When I compile, I get an error saying the SFITRAN.TMS_LOAD table does not exist. What am I doing wrong?Thanks for your reply. This is strange, I had this procedure working yesterday and then this morning I had to change something so I dropped the SFITRAN.TMS_LOAD table and since then I can't compile. When I was able to compile yesterday, I did not have to login as SFITRAN and do the grants.
I am having problems trying to login as SFITRAN. I checked dba_users and this user has a password of EXTERNAL, so when I tried to login I used / as the password with no luck. -
Hi to All,
While creating a procedure I got a "ORA-00942: table or view does not exist" the table is there I can do a describe do a select, but some reason it does not see it if referenced in the procedure, if I use the same statement in "DECLARE" instead of "CREATE OR REPLACE" it sees the table and no error is given.
Below is the code:
FFS> DESC STE_V1SITE
Name
SITE_ID_NU
ST_NU
SITE_NU
SITE_FMLY_ID_NU
PRE_SITE_ID_NU
SITE_DS
FFS> CREATE OR REPLACE PROCEDURE temp IS
2
3 CURSOR site_ds_cur (
4 P_site_id IN NUMBER
5 , P_Thru_Dt IN DATE
6 ) IS
7 SELECT site.site_ds
8 FROM ste_v1site site
9 WHERE site.site_id_nu = P_site_id ;
10
11 TYPE site_ds_typ IS
12 TABLE OF ste_v1site.site_ds%TYPE
13 INDEX BY BINARY_INTEGER;
14
15 site_ds_tbl site_ds_typ;
16
17 BEGIN
18 NULL;
19
20 END;
21 /
Warning: Procedure created with compilation errors.
FFS> SHO ERROR
Errors for PROCEDURE TEMP:
LINE/COL ERROR
7/3 PL/SQL: SQL Statement ignored
8/10 PL/SQL: ORA-00942: table or view does not exist
11/3 PL/SQL: Item ignored
12/12 PLS-00201: identifier 'STE_V1SITE' must be declared
FFS>
FFS> DECLARE
2 CURSOR site_ds_cur (
3 P_site_id IN NUMBER
4 , P_Thru_Dt IN DATE
5 ) IS
6 SELECT site.site_ds
7 FROM ste_v1site site
8 WHERE site.site_id_nu = P_site_id ;
9
10 TYPE site_ds_typ IS
11 TABLE OF ste_v1site.site_ds%TYPE
12 INDEX BY BINARY_INTEGER;
13
14 site_ds_tbl site_ds_typ;
15
16 BEGIN
17 NULL;
18 END;
19 /
PL/SQL procedure successfully completed.
FFS> CREATE OR REPLACE PROCEDURE temp IS
2 BEGIN
3 NULL;
4 END;
5 /
Procedure created.
Thanks to all those who provide help...
Habeebsomthing like this
SQL> declare
2 cursor c(pdeptno number) is select empno,ename from emp
3 where deptno=pdeptno;
4 begin
5 for i in c(10) loop
6 dbms_output.PUT_LINE(i.empno||' : '||i.ename);
7 end loop;
8 end;
9 /
7782 : CLARK
7839 : KING
7934 : MILLER
PL/SQL procedure successfully completed. -
Error compiling procedure send mail
Hi all,
I have this error message (on 10.2 version)
Table or view doesn't exist
At this line
+ select dd.directory_name into directory_name from dba_directories dd+
+ where dd.directory_path = line and rownum = 1;+
But I don't know how can resolve it.
This is the all procedure
[http://forums.oracle.com/forums/]
CREATE OR REPLACE PROCEDURE P_SPEDEMAIATTA ( from_name IN VARCHAR2,
to_names IN VARCHAR2,
subject IN VARCHAR2,
message IN VARCHAR2 default null,
html_message IN VARCHAR2 default null,
cc_names IN VARCHAR2 default null,
bcc_names IN VARCHAR2 default null,
filename1 varchar2 default null,
filetype1 varchar2 default 'text/plain',
filename2 varchar2 default null,
filetype2 varchar2 default 'text/plain',
filename3 varchar2 default null,
filetype3 varchar2 default 'text/plain',
V_CODIERRO OUT VARCHAR2,
V_DESCERRO OUT VARCHAR2)
is
-- Change the SMTP host name and port number below to your own values,
-- if not localhost on port 25:
smtp_host varchar2(256) := 'SMTP.INET.IT';
smtp_port number := 25;
-- Change the boundary string, if needed, which demarcates boundaries of
-- parts in a multi-part email, and should not appear inside the body of
-- any part of the e-mail:
boundary constant varchar2(256) := 'CES.Boundary.DACA587499938898';
recipients varchar2(32767);
directory_path varchar2(256);
file_name varchar2(256);
crlf varchar2(2):= chr(13) || chr(10);
mesg varchar2(32767);
conn UTL_SMTP.CONNECTION;
type varchar2_table is table of varchar2(256) index by binary_integer;
file_array varchar2_table;
type_array varchar2_table;
i binary_integer;
my_code number;
my_errm varchar2(32767);
-- Function to return the next email address in the list of email addresses,
-- separated by either a "," or a ";". From Oracle's demo_mail. The format
-- of mailbox may be in one of these:
-- someone@some-domain
-- "Someone at some domain" <someone@some-domain>
-- Someone at some domain <someone@some-domain>
FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
addr VARCHAR2(256);
i pls_integer;
FUNCTION lookup_unquoted_char(str IN VARCHAR2,
chrs IN VARCHAR2) RETURN pls_integer IS
c VARCHAR2(5);
i pls_integer;
len pls_integer;
inside_quote BOOLEAN;
BEGIN
inside_quote := false;
i := 1;
len := length(str);
WHILE (i <= len) LOOP
c := substr(str, i, 1);
IF (inside_quote) THEN
IF (c = '"') THEN
inside_quote := false;
ELSIF (c = '\') THEN
i := i + 1; -- Skip the quote character
END IF;
GOTO next_char;
END IF;
IF (c = '"') THEN
inside_quote := true;
GOTO next_char;
END IF;
IF (instr(chrs, c) >= 1) THEN
RETURN i;
END IF;
<<next_char>>
i := i + 1;
END LOOP;
RETURN 0;
END;
BEGIN
addr_list := ltrim(addr_list);
i := lookup_unquoted_char(addr_list, ',;');
IF (i >= 1) THEN
addr := substr(addr_list, 1, i - 1);
addr_list := substr(addr_list, i + 1);
ELSE
addr := addr_list;
addr_list := '';
END IF;
i := lookup_unquoted_char(addr, '<'>');
IF (i >= 1) THEN
addr := substr(addr, 1, i - 1);
END IF;
END IF;
i := lookup_unquoted_char(addr, '@');
IF (i = 0 and smtp_host != 'localhost') THEN
i := instr(smtp_host, '.', -1, 2);
addr := addr || '@' || substr(smtp_host, i + 1);
END IF;
addr := '<'>';
RETURN addr;
END;
-- Procedure to split a file pathname into its directory path and file name
-- components.
PROCEDURE split_path_name(file_path IN VARCHAR2, directory_path OUT VARCHAR2,
file_name OUT VARCHAR2) IS
pos number;
begin
-- Separate the filename from the directory name
pos := instr(file_path,'/',-1);
if pos = 0 then
pos := instr(file_path,'\',-1);
end if;
if pos = 0 then
directory_path := null;
else
directory_path := substr(file_path,1,pos - 1);
end if;
file_name := substr(file_path,pos + 1);
end;
-- Procedure to append a file's contents to the e-mail
PROCEDURE append_file(directory_path IN VARCHAR2, file_name IN VARCHAR2,
file_type IN VARCHAR2, conn IN OUT UTL_SMTP.CONNECTION) IS
generated_name varchar2(30) := 'CESDIR' || to_char(sysdate,'HH24MISS');
directory_name varchar2(30);
file_handle utl_file.file_type;
bfile_handle bfile;
bfile_len number;
pos number;
read_bytes number;
line varchar2(1000);
data raw(200);
my_code number;
my_errm varchar2(32767);
begin
begin
-- Grant access to the directory, unless already defined, and open
-- the file (as a bfile for a binary file, otherwise as a text file).
begin
line := directory_path;
select dd.directory_name into directory_name from dba_directories dd
where dd.directory_path = line and rownum = 1;
exception
when no_data_found then
directory_name := generated_name;
end;
if directory_name = generated_name then
execute immediate 'create or replace directory ' || directory_name ||
' as ''' || directory_path || '''';
execute immediate 'grant read on directory ' || directory_name ||
' to public';
end if;
if substr(file_type,1,4) != 'text' then
bfile_handle := bfilename(directory_name,file_name);
bfile_len := dbms_lob.getlength(bfile_handle);
pos := 1;
dbms_lob.open(bfile_handle,dbms_lob.lob_readonly);
else
file_handle := utl_file.fopen(directory_name,file_name,'r');
end if;
-- Append the file contents to the end of the message
loop
-- If it is a binary file, process it 57 bytes at a time,
-- reading them in with a LOB read, encoding them in BASE64,
-- and writing out the encoded binary string as raw data
if substr(file_type,1,4) != 'text' then
if pos + 57 - 1 > bfile_len then
read_bytes := bfile_len - pos + 1;
else
read_bytes := 57;
end if;
dbms_lob.read(bfile_handle,read_bytes,pos,data);
utl_smtp.write_raw_data(conn,utl_encode.base64_encode(data));
pos := pos + 57;
if pos > bfile_len then
exit;
end if;
-- If it is a text file, get the next line of text, append a
-- carriage return / line feed to it, and write it out
else
utl_file.get_line(file_handle,line);
utl_smtp.write_data(conn,line || crlf);
end if;
end loop;
-- Output any errors, except at end when no more data is found
exception
when no_data_found then
null;
when others then
my_code := SQLCODE;
my_errm := SQLERRM;
dbms_output.put_line('Error code ' || my_code || ': ' ||
my_errm);
end;
-- Close the file (binary or text)
if substr(file_type,1,4) != 'text' then
dbms_lob.close(bfile_handle);
else
utl_file.fclose(file_handle);
end if;
if directory_name = generated_name then
execute immediate 'drop directory ' || directory_name;
end if;
end;
begin
-- Load the three filenames and file (mime) types into an array for
-- easier handling later
file_array(1) := filename1;
file_array(2) := filename2;
file_array(3) := filename3;
type_array(1) := filetype1;
type_array(2) := filetype2;
type_array(3) := filetype3;
-- Open the SMTP connection and set the From and To e-mail addresses
conn := utl_smtp.open_connection(smtp_host,smtp_port);
utl_smtp.helo(conn,smtp_host);
recipients := from_name;
utl_smtp.mail(conn,get_address(recipients));
recipients := to_names;
while recipients is not null loop
utl_smtp.rcpt(conn,get_address(recipients));
end loop;
recipients := cc_names;
while recipients is not null loop
utl_smtp.rcpt(conn,get_address(recipients));
end loop;
recipients := bcc_names;
while recipients is not null loop
utl_smtp.rcpt(conn,get_address(recipients));
end loop;
utl_smtp.open_data(conn);
-- Build the start of the mail message
mesg := 'Date: ' || TO_CHAR(SYSDATE,'dd Mon yy hh24:mi:ss') || crlf ||
'From: ' || from_name || crlf ||
'Subject: ' || subject || crlf ||
'To: ' || to_names || crlf;
if cc_names is not null then
mesg := mesg || 'Cc: ' || cc_names || crlf;
end if;
if bcc_names is not null then
mesg := mesg || 'Bcc: ' || bcc_names || crlf;
end if;
mesg := mesg || 'Mime-Version: 1.0' || crlf ||
'Content-Type: multipart/mixed; boundary="' || boundary || '"' ||
crlf || crlf ||
'This is a Mime message, which your current mail reader may not' || crlf ||
'understand. Parts of the message will appear as text. If the remainder' || crlf ||
'appears as random characters in the message body, instead of as' || crlf ||
'attachments, then you''ll have to extract these parts and decode them' || crlf ||
'manually.' || crlf || crlf;
utl_smtp.write_data(conn,mesg);
-- Write the text message or message file, if any
if message is not null then
mesg := '--' || boundary || crlf ||
'Content-Type: text/plain; name="message.txt"; charset=US-ASCII' ||
crlf ||
'Content-Disposition: inline; filename="message.txt"' || crlf ||
'Content-Transfer-Encoding: 7bit' || crlf || crlf;
utl_smtp.write_data(conn,mesg);
if instr(message,'/') = 1 or instr(message,':\') = 2 or
instr(message,'\\') = 1 then
split_path_name(message,directory_path,file_name);
append_file(directory_path,file_name,'text',conn);
utl_smtp.write_data(conn,crlf);
else
utl_smtp.write_data(conn,message || crlf);
end if;
end if;
-- Write the HTML message or message file, if any
if html_message is not null then
mesg := '--' || boundary || crlf ||
'Content-Type: text/html; name="message.html"; charset=US-ASCII' ||
crlf ||
'Content-Disposition: inline; filename="message.html"' || crlf ||
'Content-Transfer-Encoding: 7bit' || crlf || crlf;
utl_smtp.write_data(conn,mesg);
if instr(html_message,'/') = 1 or instr(html_message,':\') = 2 or
instr(html_message,'\\') = 1 then
split_path_name(html_message,directory_path,file_name);
append_file(directory_path,file_name,'text',conn);
utl_smtp.write_data(conn,crlf);
else
utl_smtp.write_data(conn,html_message || crlf);
end if;
end if;
-- Append the files
for i in 1..3 loop
-- If the filename has been supplied ...
if file_array(i) is not null then
split_path_name(file_array(i),directory_path,file_name);
-- Generate the MIME boundary line according to the file (mime) type
-- specified.
mesg := crlf || '--' || boundary || crlf;
if substr(type_array(i),1,4) != 'text' then
mesg := mesg || 'Content-Type: ' || type_array(i) ||
'; name="' || file_name || '"' || crlf ||
'Content-Disposition: attachment; filename="' ||
file_name || '"' || crlf ||
'Content-Transfer-Encoding: base64' || crlf || crlf ;
else
mesg := mesg || 'Content-Type: application/octet-stream; name="' ||
file_name || '"' || crlf ||
'Content-Disposition: attachment; filename="' ||
file_name || '"' || crlf ||
'Content-Transfer-Encoding: 7bit' || crlf || crlf ;
end if;
utl_smtp.write_data(conn,mesg);
-- Append the file contents to the end of the message
append_file(directory_path,file_name,type_array(i),conn);
utl_smtp.write_data(conn,crlf);
end if;
end loop;
-- Append the final boundary line
mesg := crlf || '--' || boundary || '--' || crlf;
utl_smtp.write_data(conn,mesg);
-- Close the SMTP connection
utl_smtp.close_data(conn);
utl_smtp.quit(conn);
exception
when utl_smtp.transient_error or utl_smtp.permanent_error then
my_code := SQLCODE;
my_errm := SQLERRM;
V_CODIERRO := SQLCODE;
V_DESCERRO := SQLERRM;
begin
utl_smtp.quit(conn);
exception
when utl_smtp.transient_error or utl_smtp.permanent_error then
null;
end;
-- raise_application_error(-20000,
-- 'Failed to send mail - SMTP server down or unavailable: Error code ' ||
-- my_code || ': ' || my_errm);
when others then
my_code := SQLCODE;
my_errm := SQLERRM;
V_CODIERRO := SQLCODE;
V_DESCERRO := SQLERRM;
raise_application_error(-20000,
'Failed to send mail: Error code ' || my_code || ': ' || my_errm);
end;
Edited by: mosquito70 on Jan 22, 2009 12:33 PMThank's,
but the problem is that I have the system user password but I haven't that of sys.
So, if I try to run the statment
grant select on dba_directories to myuser;
I have the this code error ORA-01031
How can resolve, without use all_directories?
Thank's
Bye -
Error while compiling procedure
Hai All
I have created a procedure its get created and while executing its get an error
My Requirement
I have a table called attendance and the fields are
Empcode var,name var intime date,outtime date ,WTime number, ETime number ,L_in number, L_out number
So Now i need to calculate How many minutes the employees come late for working hours The shifts starts at 0815 and the grace mins Is 5 min SO after 0820 i need to calculate L_In and The shifts closed At 1645 and Now i need to calculate How many min Before He is going
MY Procedure
create or replace PROCEDURE L_TIME(in_time dail_att.intime%type
,out_time dail_att.outtime%type,
id_in in dail_att.idein%type,
id_out out dail_att.ideout%type,
F_date dail_att.attend_Date%type)
IS
BEGIN
If to_char(in_time,'hh24mi') > 0820 and to_char(out_time,'hh24mi') < 1650 then
if id_in is null then
update dail_att set idein= (to_char(intime,'hh24mi')-0820) where attend_date= f_date;
else
update dail_att set ideout= (to_char(outtime,'hh24mi')-1650)where attend_date=f_date;
end if;
While iam executin like this
execute L_TIME ('01-jan-2010 0820','01-jan-2010 1520','01-jan-2010');
I got an error How to solve these error
Thanks In Advance
Srikkanth.MAssuming your parameter are based on DATE table columns...
you are passing in VARCHAR into the procedure. These needs to be implicitly converted to a DATE, depending on your NLS settings. It's better to pass in DATEs instead of strings.
to_date ('01-jan-2010 0820','dd-mon-yyyy hh24mi')In your procedure compare DATEs to DATEs; don't convert them to Char. You rely a lot on implicit datatype conversion, like this one
to_char(in_time,'hh24mi') > 0820 Here you compare Char with a NUMBER....
Next time also post the exception that you are getting. -
Different compilation procedure for 2.6.29.3?
I compiled a custom kernel with the new 2.6.29.3 kernel today but this time I do not have a bzImage file in arch/x86/boot. Instead, I have a vmlinux file at the top level of the kernel source folder. Is this the image file I am supposed to boot from or am I missing something?
Everytime I compile a kernel, the image is called vmlinuz.
Before configuring, I run: make mrproper && make menuconfig
After configuring, I run: make && make modules_install && make install -
Error message when compiling invalid packages and procedures
Hi.
I have a routine for copying certain data from a production database to a test database. To do this I disable constraints and triggers, truncate tables, copy tables and enable triggers and constraints again.
Now several of my functions, procedures and packages are made invalid and marked with a red cross. In SQL Developer I can compile invalid functions, procedures and packages. When I compile functions it works fine, but when compiling procedures and packages I get the following error message:
An error was encountered performing the requested operation:
ORA-00904: "ATTRIBUTE": Invalid identifier
Vendor code 904
When I click OK on this message I get a confirmation saying:
Packages have been compiled with #0.CNT# errors.
I had this error in both the previous and the new version. Is this a bug or is there a way to come around it? When I copy and modify the SQL generated to perform this task and run it in SQL Plus it works fine.
I use Windows 2000 5.00.2195 Service Pack 4, SQL Developer version 1.2.1, Oracle 9.2.0.8.0 and Java version 1.5.0_11
Message was edited by:
SvSigi have now upgraded to Java 1.6 update 2. I still get basically the same error, but it is presented a little bit differently:
An error was encountered performing the requested operation:
ORA-00904: "ATTRIBUTE": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Vendor code 904
Are there other possible error causes than the operating system version and the database version?
We are going to install an Oracle 10 test database in a couple of weeks, so then I will find out whether the database version is the problem. -
Stored Procedure not compiling
Hi,
I am not able to compile stored proc in oracle 8i,
whenever I compile the SP, the pl/sql devloper getting hanged..
I also tried to compile it from sqlplus, even sqlplus is getting hanged.
No SP/Functions are dependent on this SP.
Plz help, Its urgent
Thanks,
ShaileshPlease try this approach:
First SQL*Plus session:
select sid from v$mystat where rownum < 2
compile procedure
Second SQL*Plus session:
select *
from v$session_wait
where sid = your_sid_from_previous_session
This will enable you to find out the reason why you are waiting
Best Regards
Krystian Zieja / mob -
How to enable a user to compile a spacific procedure
A user need rights to alter and then compile a procedure for this i give following command, but objective could not be achieved. What should i do ?.
Grant all on the_procedure to the_user.Of course said user is not the owner of of that procedure.The execute privilege wont allow a user to compile another schemas procedures, the user compiling would need the "ALTER ANY PROCEDURE" privilege, which is bad.
You could get around this by putting a stored procedure in the schema which owns the procedure you want to compile, this stored procedure could be coded to compile the procedure, then you give execute privs on that compile procedure to your other user, that way you can control what procedures the other user can compile and don't have to give it access to compile anything.
Thanks
Paul -
PROCEDURE COMPILATION AND DEPENDENCIES DOUBT
hello friends,
i have some question. yesterday while woring i faced this problem. even though i solved it, but i was unable to find the reason.
we have a procedure a which calls procedure b. every time procedure b is recompiles/compiled procedure a becomes invalid. my PL told me to solve the problem. i solved it by using packeges as packages nullifies the dependencies problems
now my question is
1) why a procedure has to compiled again n again. i mean what are the situations in which we have to recompile a subprogram? what are the advantages?
2) even though procedure a becomes invalid when we recompile procedure b, but it automatically becomes valid when we execute it(correct me if i am wron). then why should we really bother about dependencies problems?
any kind of answer will be highly appreciatedHi,
1) why a procedure has to compiled again n again. i mean what are the situations in which we have to recompile a subprogram? what are the advantages?
It is normal situation when referenced procedure is changed and recompiled then you must recompile also referencing procedure. There are two modes you can use TIMESTAMP and SIGNATURE. I think you are using TIMESTAMP mode (default) mode. In USER_OBJECTS there is field called LAST_DDL_TIME. This field keep date and time last object recompilation. When referenced object has newer date then referencing object become invalid. Oracle during calling referenced procedure will try to recompile it automatically. Second mode is SIGNATURE. In this mode TIMESTAMP is not stored, instead SIGNATURE is stored. So recompilation is done only when signature is changing. You can use it setting REMOTE_DEPENDENCIES_MODE=SIGNATURE in init.ora file.
2) even though procedure a becomes invalid when we recompile procedure b, but it automatically becomes valid when we execute it(correct me if i am wron). then why should we really bother about dependencies problems?
When procedure is invalid and you run it when oracle will try to compile it first. It standard action.
Peter D.
Maybe you are looking for
-
I'm using "Oracle BI Publisher Template Builder for Word" Version: 10.1.3.2.1 Build 87 When I try to add <?start:body?> and <?end body?> tags get error in preview to pdf My structure is: for-each G_INVOICE [TABLE WITH HEADER INFORMATION] <?start:bod
-
Hi all Is there any way to mass download the Originals from the following scenario - from cv04n by selecting multiple DIRs Regards Aby
-
Can't install FlashPlayer in FF (Fedora 12_64)
Hi all, When I try to watch video, FF says "Adobe Flash Player either is not installed in your browser or has older version than required." When I try to install it from Adobe web sites using the option of yum (linux), it tells me that the rpm packag
-
Documentation for Alerts in System Monitoring (DSWP)
Hello Community! I am working with SAP Solution Manager for about a week. At the moment i am trying to set up a useful system monitoring with System Monitor. Because i did not found a helpful documentation yet and i do not want to proceed in trail&er
-
Derivation segment (new GL) from profit center in CO-PA
Hi experts, i have problem with derivation segment (new GL) from profit center in CO-PA. I tried Table lookup in KEDR to CEPC table, but SAP want date - DATBI (Valid To Date). I don´t know which Field name with origin CO-PA should choose? How solve t