Problem in package body creation
Hello,
I am a newbie in PL/SQL.I am sorry for posting a very silly question,but I am struggling since 2 days trying to get this PL/SQL code working.Dont know whats wrong with it.I consulated a lot of tutorials and online sources..But still couldnt figure out whats wrong.I get the following error
LINE/COL ERROR
6/1 PLS-00103: Encountered the symbol "CREATE"
The code is like following
CREATE or replace package test AS
procedure extract_tmp_reifs ;
end;
CREATE OR REPLACE PACKAGE BODY test IS procedure extract_info(models IN varchar2,rulebases IN varchar2) is
stmt varchar2(4000);
model_name varchar2(4000);
rulebase_name varchar2(4000);
--Create table invocation
begin
model_name := models;
rulebase_name := rulebases;
stmt := 'create table '|| model_name ||'_'||rulebase_name||'_t$'||'(id number primary key, triple_id number, sd date, ed date)';
execute immediate stmt;
commit;
end extract_tmp_reifs;
end temporal_reification;
The line 6 is for the Create package body thing.
WIll be grateful if some one can give a hint as to whats wrong wiith it.Please help me
Thanks
Regards
Prateek!
> The requirement is to have a procedure which when provided two parameters
creates a table based on the parameters,and then values are inserted into the
table by using data from other tables.Thats why the dynamic creation of table.
I still don't like it. Besides the dynamic create issue, there is a relational design issue at stake here.
Attribute data is to be carried in the columns of a table - and not in the table name. The correct relation (from the little code I've seen posted here) is:
Model Rules = ( Model ID, Rulebase ID, Tripple ID, Start Date, End Date)
And not multiple relations where the relational table's name is dynamic and the attribute data carried in the name of the table. To put it into context, it is the same as defining an Invoice Relation as:
Invoices_20070305 = ( Invoice ID, Customer ID, Product ID, Quantity, Unit Cost, ..etc.. )
Instead of putting the date as an attribute value into the relation:
Invoices = ( Invoice ID, Invoice Date, Customer ID, Product ID, Quantity, Unit Cost, ..etc.. )
Using this dynamic method you can wind up with 1000's of tables for Model Rules. How are you going to make use of referential integrity? What about indexing? What about the complexity of having all these many dynamic tables and attempting to query them with a single query?
99% of the time, dynamically creating relations (tables) in a RDBMS is the wrong thing to do. And unless you can convince me that you have the 1% exception to the rule, I'm going to be very skeptical about the dynamic table create approach you have chosen. It is simply wrong.
Similar Messages
-
DBMS_STATS package body creation
How do the procedures in the DBMS_STATS package get created? I ran the dbmsstat.sql procedure, but the gather_schema_stats procedure didn't work, so I read the entire dbmsstat.sql procedure, and all it creates is the package, not the package body. What script do I have to run in order to create the package body?
I'm running 8i on Solaris 2.6, if that matters.
Thanks,
RichWhen I try to execute dbms_stats.gather_schema_stats, I get:
ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04067: not executed, package body "SYS.DBMS_STATS" does not exist
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 1
I just queried dba_source and found the dbms_stats package, but not the package body. If it was there before, maybe I wiped it out by running dbmsstats.sql again (when you create or replace a package, is the package body discarded?).
Thanks for the tip on prvtstat.plb. I'll try running it and see what happens.
Rich -
Package body name in script - Oracle SQL Developer Data Modeler 3.0.0.6.
Hi,
I have problem with package body full name. In package body properties I have my <schema_name>. But there is something like "user5" insted my <schema_name> in package body script. I replaced it and saved it. But, when I re opened package body, there is user5 again, while name of package is OK.
Can I set some property to stay there my schema_name?
Thank you.
Stefan.
Edited by: user13617034 on 4.4.2011 5:10
Edited by: user13617034 on 4.4.2011 5:12SQL Server Physical model doesn't save table identity column.
here are the steps to get this bug:
1. create a table in relational model with a column as an integer to be used as an identity.
2. create or open a physical model for SQL-SERVER 2005
3. open the table in the physical model
4. edit the integer column property dialog
5. tick the identity check box and close the property dialog
6. save the model and close it
7. open it again, you will find the identity check is removed! (probably not saved from the start) -
SYSDBA - problem with viewing other users package body texts on sys account
Hi,
SQL Dev 1.0.0.15.27 has problem with correct display of other users package body texts on sys account. All bodies have "create or replace" text instead of all pck. bodies text.
I guest it's problem with SYSDBA role. On system account text is displayed correctly. Quest SQL Navigator 5.x has no problem with this. Any ideas ?
Regards,
MMHi Everyone,
Just so I can close the case on this issue, although I was successful in
using CSS to resolve the issue, actually, the issue was not really
resolved. There was (for me) still the problem of rollover images not
working in IE, and if I were ever to get another good night's sleep, I
would need to resolve it -- so I did. Recall me saying earlier about the
sizes being brought in to the javascript code by Dreamweaver? The original
issue with having the size of the small image in the code caused the code
to see the larger image as small also! However, when I deleted those size
attributes' numbers, I failed to delete the words "width" and "height"
along with the double quotes following each. So, while the other browsers
ignored these "blank" attributes within these double quotes, IE apparently
didn't, reading these "blank" values as some very small value, thus
displaying the image in the absolutely smallest size possible! Wow! When I
removed these two blank attributes, my problem went away! Live and learn!
So, to all who were desperately trying to assist me, please accept my
deepest and most sincere apologies. All the while I was blaming IE, I was
the guilty one!!! Shame on me, and thanks for the wonderful responses I
received from the Dreamweaver forum team. I will go and stand in the corner
for 8 hours with my dunce cap on...
Joe Dardard -
Compiling package body problem
hello
i have a problem with portal 9.0.2.2.22(win2k server). When i try to log in i get the error
Error: Could not open web cache connection. The portal use-web-cache setting is set to ON while web cache may be down. (WWC-40019)
after that i run oracle enterprise manager console, logged into iasdb and tried to compile different package bodies(dbe_build_sql, wwv_qbe,...) and get the error:
Line # = 0 Column # = 0 Error Text = PLS-00801: internal error [56106]
inside this package body there is only one word
wrapped
and nothing else
on a different machine i have in the same package body tons of code(dbe_build_sql consists of 20622 lines), inside my package only one word
wrapped
where is the problem?
can anybody help me? please
need help
thanks
MarjanMarjan,
Try to post your question in the Portal Caching forum. -
3.1EA2 bug still not fixed - Members of package body not listed in the tree
Hi, I was working today with SQL Developer again and found that this bug is still not fixed even when it was reported more than 1 year ago!!!
I did a quick search and found it here
Package Body Tree not always showing
The problem is when you expand the package specification or package body tree, not all members of the specification/body are listed. This is mostly observable in the package body, but it regards to the specification as well.
Consider this case:
CREATE TABLE EMP (
ID NUMBER(6,0) DEFAULT 0,
NAME VARCHAR2(20 BYTE) DEFAULT NULL,
DEPT VARCHAR2(20 BYTE) DEFAULT NULL,
FUNCTION VARCHAR2(20 BYTE),
PROCEDURE VARCHAR2(20 BYTE));
CREATE TABLE LOOP (
AREA VARCHAR2(5),
VALUE VARCHAR2(2));
CREATE OR REPLACE PACKAGE Test_Package1 AS
gvc_const CONSTANT VARCHAR2(10) := 'xxx';
PROCEDURE Test(p_RC OUT NUMBER,
p_ID IN NUMBER);
END Test_Package1;
CREATE OR REPLACE PACKAGE BODY Test_Package1 AS
PROCEDURE Test(p_RC OUT NUMBER,
p_ID IN NUMBER)
IS
BEGIN
--INSERT INTO EMP (ID, NAME, DEPT, PROCEDURE) VALUES (1, 'Tina', 'xxx', 'xxx');
--INSERT INTO EMP (ID, NAME, DEPT, FUNCTION) VALUES (2, 'Jeff', 'xxx', 'xxx');
--INSERT INTO LOOP(AREA, VALUE) VALUES('a','b');
NULL;
END;
END Test_Package1;Compile the package specification and the body. Expand the spec + body in the tree. Uncomment any of the commented lines in the package body and compile the body again. Now expand the package body again and look what is displayed.
Why? It is because SQL Developer handles words "Function", "Procedure" and "Loop" as keywords and according to them does the parsing.
Another case
CREATE OR REPLACE PACKAGE Test_Package1 AS
gvc_const CONSTANT VARCHAR2(10) := 'xxx';
TYPE Loop_rec IS RECORD(
item1 LOOP.AREA%TYPE);
PROCEDURE Test(p_RC OUT NUMBER,
p_ID IN NUMBER);
END Test_Package1;Compile just this specification and try to expand it in the tree. Again, during parsing the package, SQL Developer takes the word "LOOP" into consideration and fails to parse the specification.
There is exactly the same problem when you declare functions from external dll libraries in package body. Since there is no "END;" in this case, SQL Developer's parser fails...
To me it seems you simply blindly took some keywords like "FUNCTION" and expect there will be some "END;" keyword corresponding with it.
Can anyone have a look at this and finally fix it?Hi,
Thanks for trying out SQL Developer 3.1 EA2 and providing a clear, reproducible test case for this issue. I logged an internal bug for it:
Bug 13438696 - 3.1EA2: FORUM: CERTAIN KEYWORDS IN PKG BODY BLOCK MEMBERS FROM CONN VIEW TREE
It seems the bug noted in the other forum thread you reference has been fixed, but really had nothing to do with problems discussed either here or there. That fix involved adding an Edit Body... item to the Package context menu in the Schema Browser, not displaying Package members correctly in the Connection view tree.
Regards,
Gary
SQL Developer Team -
Hi
With the following line of code i am having problems with the following line of code ...
sql := (
' IF INSERTING THEN '||CHR(10)||
' v_operation := ''INSERT''; '||CHR(10)||
' ELSIF UPDATING THEN '||CHR(10)||
' v_operation := ''UPDATE''; '||CHR(10)||
' ELSE '||CHR(10)||
' v_operation := ''DELETE''; '||CHR(10)||
' END IF; '||CHR(13));
When I execute my package body I get an error with the above in my package ...
any ideas why ?Bad variable name.
ME_XE?declare
2 sql long;
3 begin
4 null;
5 end;
6 /
sql long;
ERROR at line 2:
ORA-06550: line 2, column 1:
PLS-00103: Encountered the symbol "SQL" when expecting one of the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor
The symbol "<an identifier> was inserted before "SQL" to continue.
Elapsed: 00:00:00.06
ME_XE?declare
2 wsql long;
3 begin
4 null;
5 end;
6 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.03
ME_XE?
{code} -
Sql developer hangs when saving pl/sql external package or package body fil
When I open a package body file I can modify the contents of the file.
Compilation of the file works fine but when I want to close or save the file SQL developer hangs. I use version 1.2 (previous version did have the same problem.)
Somebody has an idee what I'am doing wrong?Are you using 1.2.1.32.13?
Sue -
Problem with package that create mail with PDF attachment
Hola,
I've this problem when I use the Oracle Package called "demo_mail",
that I have download from this forum en september.
The code of the Package, I post bottom, now I
write the records of the Package,
that I believe is the core of the problem:
demo_mail.begin_attachment( conn => conn,
mime_type => 'application/pdf',
inline => TRUE, filename => ''|| VC_NOMEFILE ||'',
transfer_enc => 'base64');
The mime_type is correct?
Why when I open the attachment of the mail, it say me that file type
is not correct or the file has been damneged? I need help!
Thank's
*********************************************************The steps that I've done:
1. PACKAGE demo_mail
2. PACKAGE BODY demo_mail
3. procedure P_SPEDMAILSERVATTA (that call package) this
Cannot write the code, because this the result. :(((
thank's
CREATE OR REPLACE PACKAGE demo_mail IS
-- Customize the SMTP host, port and your domain name below.
smtp_host VARCHAR2(256) := 'XXX.YYYY.IT';
smtp_port PLS_INTEGER := 25;
smtp_domain VARCHAR2(256) := 'YYYY.it';
-- Customize the signature that will appear in the email's MIME header.
-- Useful for versioning.
MAILER_ID CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
--------------------- End Customizable Section ---------------------
-- A unique string that demarcates boundaries of parts in a multi-part email
-- The string should not appear inside the body of any part of the email.
-- Customize this if needed or generate this randomly dynamically.
BOUNDARY CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
FIRST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
LAST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
utl_tcp.CRLF;
-- A MIME type that denotes multi-part email (MIME) messages.
MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
BOUNDARY || '"';
MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3;
-- A simple email API for sending email in plain text in a single call.
-- The format of an email address is one of these:
-- someone@some-domain
-- "Someone at some domain" <someone@some-domain>
-- Someone at some domain <someone@some-domain>
-- The recipients is a list of email addresses separated by
-- either a "," or a ";"
PROCEDURE mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
message IN VARCHAR2);
-- Extended email API to send email in HTML or plain text with no size limit.
-- First, begin the email by begin_mail(). Then, call write_text() repeatedly
-- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
-- email in non-ASCII or multi-byte character set. End the email with
-- end_mail().
FUNCTION begin_mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
priority IN PLS_INTEGER DEFAULT NULL)
RETURN utl_smtp.connection;
-- Write email body in ASCII
PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2);
-- Write email body in non-ASCII (including multi-byte). The email body
-- will be sent in the database character set.
PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2);
-- Write email body in binary
PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
message IN RAW);
-- APIs to send email with attachments. Attachments are sent by sending
-- emails in "multipart/mixed" MIME format. Specify that MIME format when
-- beginning an email with begin_mail().
-- Send a single text attachment.
PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
data IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE);
-- Send a binary attachment. The attachment will be encoded in Base-64
-- encoding format.
PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
data IN RAW,
mime_type IN VARCHAR2 DEFAULT 'application/octet',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE);
-- Send an attachment with no size limit. First, begin the attachment
-- with begin_attachment(). Then, call write_text repeatedly to send
-- the attachment piece-by-piece. If the attachment is text-based but
-- in non-ASCII or multi-byte character set, use write_mb_text() instead.
-- To send binary attachment, the binary content should first be
-- encoded in Base-64 encoding format using the demo package for 8i,
-- or the native one in 9i. End the attachment with end_attachment.
PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
transfer_enc IN VARCHAR2 DEFAULT NULL);
-- End the attachment.
PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
last IN BOOLEAN DEFAULT FALSE);
-- End the email.
PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
-- Extended email API to send multiple emails in a session for better
-- performance. First, begin an email session with begin_session.
-- Then, begin each email with a session by calling begin_mail_in_session
-- instead of begin_mail. End the email with end_mail_in_session instead
-- of end_mail. End the email session by end_session.
FUNCTION begin_session RETURN utl_smtp.connection;
-- Begin an email in a session.
PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
priority IN PLS_INTEGER DEFAULT NULL);
-- End an email in a session.
PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
-- End an email session.
PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
END;
CREATE OR REPLACE PACKAGE BODY demo_mail IS
-- Return the next email address in the list of email addresses, separated
-- by either a "," or a ";". 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 AS
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, i + 1);
i := instr(addr, '>');
IF (i >= 1) THEN
addr := substr(addr, 1, i - 1);
END IF;
END IF;
RETURN addr;
END;
-- Write a MIME header
PROCEDURE write_mime_header(conn IN OUT NOCOPY utl_smtp.connection,
name IN VARCHAR2,
value IN VARCHAR2) IS
BEGIN
utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
END;
-- Mark a message-part boundary. Set <last> to TRUE for the last boundary.
PROCEDURE write_boundary(conn IN OUT NOCOPY utl_smtp.connection,
last IN BOOLEAN DEFAULT FALSE) AS
BEGIN
IF (last) THEN
utl_smtp.write_data(conn, LAST_BOUNDARY);
ELSE
utl_smtp.write_data(conn, FIRST_BOUNDARY);
END IF;
END;
PROCEDURE mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
message IN VARCHAR2) IS
conn utl_smtp.connection;
BEGIN
conn := begin_mail(sender, recipients, subject);
write_text(conn, message);
end_mail(conn);
END;
FUNCTION begin_mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
priority IN PLS_INTEGER DEFAULT NULL)
RETURN utl_smtp.connection IS
conn utl_smtp.connection;
BEGIN
conn := begin_session;
begin_mail_in_session(conn, sender, recipients, subject, mime_type,
priority);
RETURN conn;
END;
PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2) IS
BEGIN
utl_smtp.write_data(conn, message);
END;
PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2) IS
BEGIN
utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
END;
PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
message IN RAW) IS
BEGIN
utl_smtp.write_raw_data(conn, message);
END;
PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
data IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE) IS
BEGIN
begin_attachment(conn, mime_type, inline, filename);
write_text(conn, data);
end_attachment(conn, last);
END;
PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
data IN RAW,
mime_type IN VARCHAR2 DEFAULT 'application/octet',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE) IS
i PLS_INTEGER;
len PLS_INTEGER;
BEGIN
begin_attachment(conn, mime_type, inline, filename, 'base64');
-- Split the Base64-encoded attachment into multiple lines
i := 1;
len := utl_raw.length(data);
WHILE (i < len) LOOP
IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
-- After upgrade to Oracle 9i, replace demo_base64.encode with the
-- native utl_encode.base64_encode for better performance:
-- utl_smtp.write_raw_data(conn,
-- utl_encode.base64_encode(utl_raw.substr(data, i,
-- MAX_BASE64_LINE_WIDTH)));
utl_smtp.write_raw_data(conn,
utl_encode.base64_encode(utl_raw.substr(data, i,
MAX_BASE64_LINE_WIDTH)));
ELSE
-- After upgrade to Oracle 9i, replace demo_base64.encode with the
-- native utl_encode.base64_encode for better performance:
-- utl_smtp.write_raw_data(conn,
-- utl_encode.base64_encode(utl_raw.substr(data, i)));
utl_smtp.write_raw_data(conn,
utl_encode.base64_encode(utl_raw.substr(data, i)));
END IF;
utl_smtp.write_data(conn, utl_tcp.CRLF);
i := i + MAX_BASE64_LINE_WIDTH;
END LOOP;
end_attachment(conn, last);
END;
PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
transfer_enc IN VARCHAR2 DEFAULT NULL) IS
BEGIN
write_boundary(conn);
write_mime_header(conn, 'Content-Type', mime_type);
IF (filename IS NOT NULL) THEN
IF (inline) THEN
write_mime_header(conn, 'Content-Disposition',
'inline; filename="'||filename||'"');
ELSE
write_mime_header(conn, 'Content-Disposition',
'attachment; filename="'||filename||'"');
END IF;
END IF;
IF (transfer_enc IS NOT NULL) THEN
write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
END IF;
utl_smtp.write_data(conn, utl_tcp.CRLF);
END;
PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
last IN BOOLEAN DEFAULT FALSE) IS
BEGIN
utl_smtp.write_data(conn, utl_tcp.CRLF);
IF (last) THEN
write_boundary(conn, last);
END IF;
END;
PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
BEGIN
end_mail_in_session(conn);
end_session(conn);
END;
FUNCTION begin_session RETURN utl_smtp.connection IS
conn utl_smtp.connection;
BEGIN
-- open SMTP connection
conn := utl_smtp.open_connection(smtp_host, smtp_port);
utl_smtp.helo(conn, smtp_domain);
RETURN conn;
END;
PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
priority IN PLS_INTEGER DEFAULT NULL) IS
my_recipients VARCHAR2(32767) := recipients;
my_sender VARCHAR2(32767) := sender;
BEGIN
-- Specify sender's address (our server allows bogus address
-- as long as it is a full email address ([email protected]).
utl_smtp.mail(conn, get_address(my_sender));
-- Specify recipient(s) of the email.
WHILE (my_recipients IS NOT NULL) LOOP
utl_smtp.rcpt(conn, get_address(my_recipients));
END LOOP;
-- Start body of email
utl_smtp.open_data(conn);
-- Set "From" MIME header
write_mime_header(conn, 'From', sender);
-- Set "To" MIME header
write_mime_header(conn, 'To', recipients);
-- Set "Subject" MIME header
write_mime_header(conn, 'Subject', subject);
-- Set "Content-Type" MIME header
write_mime_header(conn, 'Content-Type', mime_type);
-- Set "X-Mailer" MIME header
write_mime_header(conn, 'X-Mailer', MAILER_ID);
-- Set priority:
-- High Normal Low
-- 1 2 3 4 5
IF (priority IS NOT NULL) THEN
write_mime_header(conn, 'X-Priority', priority);
END IF;
-- Send an empty line to denotes end of MIME headers and
-- beginning of message body.
utl_smtp.write_data(conn, utl_tcp.CRLF);
IF (mime_type LIKE 'multipart/mixed%') THEN
write_text(conn, 'This is a multi-part message in MIME format.' ||
utl_tcp.crlf);
END IF;
END;
PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
BEGIN
utl_smtp.close_data(conn);
END;
PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
BEGIN
utl_smtp.quit(conn);
END;
END;
PROMPT **********************************************************
PROMPT CREAZIONE PROCEDURA P_SPEDMAILSERVATTA
PROMPT **********************************************************
create or replace procedure P_SPEDMAILSERVATTA( VC_DESCDENOAZIE IN VARCHAR2,
VC_DESCINDIEMAI IN VARCHAR2,
VC_NUMEBOLL IN VARCHAR2,
VC_PATHFILE IN VARCHAR2,
VC_NOMEFILE IN VARCHAR2,
VC_DESCINDIEMAIMITT IN VARCHAR2)
IS
conn utl_smtp.connection;
req utl_http.req;
resp utl_http.resp;
data RAW(200);
BEGIN
conn := demo_mail.begin_mail(
sender => 'SIAG srl <'|| VC_DESCINDIEMAIMITT ||'>',
recipients => ''|| VC_DESCDENOAZIE ||' '||'<'|| VC_DESCINDIEMAI ||'>'||'',
subject => 'Invio Bollettino n.'|| VC_NUMEBOLL ||'',
mime_type => demo_mail.MULTIPART_MIME_TYPE);
demo_mail.attach_text(
conn => conn,
data => 'Spett.le <b>'|| VC_DESCDENOAZIE ||'</b> <br> in allegato Le invio il Bollettino n. '|| VC_NUMEBOLL ||'.<br> <br> Distinti Saluti <br><br> <hr align="left" width="20%"> ',
mime_type => 'text/html');
demo_mail.begin_attachment(
conn => conn,
mime_type => 'application/pdf',
inline => TRUE,
filename => ''|| VC_NOMEFILE ||'',
transfer_enc => 'base64');
-- In writing Base-64 encoded text following the MIME format below,
-- the MIME format requires that a long piece of data must be splitted
-- into multiple lines and each line of encoded data cannot exceed
-- 80 characters, including the new-line characters. Also, when
-- splitting the original data into pieces, the length of each chunk
-- of data before encoding must be a multiple of 3, except for the
-- last chunk. The constant demo_mail.MAX_BASE64_LINE_WIDTH
-- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
-- of data before encoding.
req := utl_http.begin_request('http://localhost/'|| VC_PATHFILE ||'/'|| VC_NOMEFILE ||'');
resp := utl_http.get_response(req);
BEGIN
LOOP
utl_http.read_raw(resp, data, demo_mail.MAX_BASE64_LINE_WIDTH);
demo_mail.write_raw(
conn => conn,
message => utl_encode.base64_encode(data));
END LOOP;
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;
demo_mail.end_attachment( conn => conn );
demo_mail.end_mail( conn => conn );
END;
Message was edited by:
mosquito70
Message was edited by:
mosquito70Hola, I've this problem when I use the Oracle Package called "demo_mail",
that I have download from this forum en september.
The code of the Package, I post bottom, now I
write the records of the Package,
that I believe is the core of the problem:
demo_mail.begin_attachment( conn => conn,
mime_type => 'application/pdf',
inline => TRUE, filename => ''|| VC_NOMEFILE ||'',
transfer_enc => 'base64');
The mime_type is correct?
Why when I open the attachment of the mail, it say me that file type
is not correct or the file has been damneged? I need help!
Thank's
The steps that I've done:
1. PACKAGE demo_mail
2. PACKAGE BODY demo_mail
3. procedure P_SPEDMAILSERVATTA (that call package)
I cannot post the code :(( -
AP_VENDOR_PUB_PKG PACKAGE BODY issue...
Hi there
AP_VENDOR_PUB_PKG PACKAGE BODY become invalid can any one let me how to valid this package body because due to this we are facing problem in creating supplier.
Regards,
MohsinHi Helios
Thanks for reply...please find below application & object info.
Application: R12(12.1.2)
Database: 11.1.0.7
STATUS OBJECT_NAME OBJECT_TYPE
INVALID FV_FACTS_TRANSACTIONS PACKAGE BODY
INVALID FV_FACTS_TBAL_TRANSACTIONS PACKAGE BODY
INVALID FV_BUDGET_DISTRIBUTION_HDR_V VIEW
INVALID FII_AP_INV_ON_HOLD_F_C PACKAGE BODY
INVALID FII_AP_HOLD_DATA_F_C PACKAGE BODY
INVALID FII_AP_INV_PAYMTS_F_C PACKAGE BODY
INVALID FII_AP_INV_LINES_F_C PACKAGE BODY
INVALID FII_AP_SCH_PAYMTS_F_C PACKAGE BODY
INVALID FII_AR_TRX_DIST_F_C PACKAGE BODY
INVALID FII_PA_COST_F_C PACKAGE BODY
INVALID FII_PA_REVENUE_F_C PACKAGE BODY
STATUS OBJECT_NAME OBJECT_TYPE
INVALID FII_PA_UOM_CONV_F_C PACKAGE BODY
INVALID FII_PA_BUDGET_F_C PACKAGE BODY
INVALID EDW_HR_ASG_CHNG_M_C PACKAGE BODY
INVALID EDW_HR_AGE_BAND_M_C PACKAGE BODY
INVALID EDW_HR_ASSGNMNT_M_C PACKAGE BODY
INVALID EDW_HR_GRADE_M_C PACKAGE BODY
INVALID EDW_HR_JOBS_M_C PACKAGE BODY
INVALID EDW_HR_SERVICE_M_C PACKAGE BODY
INVALID EDW_HR_MVMNT_TYP_M_C PACKAGE BODY
INVALID EDW_HR_PERSON_M_C PACKAGE BODY
INVALID EDW_HR_POSITION_M_C PACKAGE BODY
STATUS OBJECT_NAME OBJECT_TYPE
INVALID EDW_HR_REC_ACT_M_C PACKAGE BODY
INVALID EDW_ORGANIZATION_M_C PACKAGE BODY
INVALID EDW_HR_PRSN_TYP_M_C PACKAGE BODY
INVALID EDW_HR_RQN_VCNCY_M_C PACKAGE BODY
INVALID EDW_HR_REASON_M_C PACKAGE BODY
INVALID HR_EDW_WRK_CMPSTN_F_C PACKAGE BODY
INVALID EDW_MRP_DM_CLS_M_C PACKAGE BODY
INVALID EDW_MRP_FORECAST_M_C PACKAGE BODY
INVALID EDW_MRP_PLAN_M_C PACKAGE BODY
INVALID ISC_EDW_BOOK_SUM1_F_C PACKAGE BODY
INVALID EDW_MTL_INVENTORY_LOC_M_C PACKAGE BODY
STATUS OBJECT_NAME OBJECT_TYPE
INVALID OPI_EDW_COGS_F_C PACKAGE BODY
INVALID OPI_EDW_OPM_JOB_RSRC_F_C PACKAGE BODY
INVALID OPI_EDW_OPM_JOB_DETAIL_F_C PACKAGE BODY
INVALID OPI_EDW_OPMCOGS_F_C PACKAGE BODY
INVALID OPI_EDW_OPMINV_DAILY_STAT_F_C PACKAGE BODY
INVALID EDW_OPI_OPRN_M_C PACKAGE BODY
INVALID EDW_OPI_ACTV_M_C PACKAGE BODY
INVALID EDW_OPI_LOT_M_C PACKAGE BODY
INVALID EDW_OPI_PRDL_M_C PACKAGE BODY
INVALID OPI_EDW_UOM_CONV_F_C PACKAGE BODY
INVALID EDW_POA_SPLRITEM_M_C PACKAGE BODY
STATUS OBJECT_NAME OBJECT_TYPE
INVALID EDW_POA_LN_TYPE_M_C PACKAGE BODY
INVALID QP_BUILD_SOURCING_PVT_TMP PACKAGE BODY
INVALID FV_FACTS_TBAL_TRX PACKAGE BODY
INVALID FV_FACTS_TRX_REGISTER PACKAGE BODY
INVALID ITG_SYNCSUPPLIERINBOUND_PVT PACKAGE BODY
INVALID AP_VENDOR_PUB_PKG PACKAGE BODY
INVALID FV_SLA_PROCESSING_PKG PACKAGE BODY
INVALID PSA_AP_BC_PVT PACKAGE BODY
INVALID XLA_00201_AAD_S_000004_BC_PKG PACKAGE BODY
INVALID FV_SLA_UTL_PROCESSING_PKG PACKAGE BODY
INVALID XX_GET_PR_PO_INFO FUNCTION
STATUS OBJECT_NAME OBJECT_TYPE
INVALID AP_VENDOR_PUB_PKG_BK PACKAGE BODY
56 rows selected.
yes i have validated apps schema with adadmin utility as well
Regards,
Mohsin
Edited by: 920138 on Apr 26, 2012 4:13 AM -
How to put connect in the package body
Oracle 10.2 on Windows 2003
I have package body as follows: in the code, I want to connect to different user. what's the correct syntax?
create or replace package body xxx as
procedure abc1 is
begin
connect username/password@sid name.
select * from table
end;
Thanks
SActuall, my problem is solved. Thank you very much.please close the thread as answered. so that users of OTN can look into some other threads.
-
Expdp with ORA-04063: package body "SYS.DBMS_CUBE_EXP" error
Hi,
I try to use expdp to export all tables from schema BAW, but hit the following error. Oracle version is 11.2.0.2, and the package body "SYS.DBMS_CUBE_EXP" is invalid. Any idea to fix it?
Starting "BAW"."SYS_EXPORT_SCHEMA_01": baw/******** directory=DATA_PUMP_DIR met
rics=yes schemas=baw dumpfile=baw.dmp
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.GET_TABLE_DATA_OBJECTS [
ORA-31642: the following SQL statement fails:
BEGIN "SYS"."DBMS_CUBE_EXP".SCHEMA_CALLOUT(:1,0,1,'11.02.00.02.00'); END;
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_METADATA", line 1245
ORA-04063: package body "SYS.DBMS_CUBE_EXP" has errors
ORA-06508: PL/SQL: could not find program unit being called: "SYS.DBMS_CUBE_EXP"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.KUPW$WORKER", line 8353
----- PL/SQL Call Stack -----
object line object
handle number name
7000004c9656fe0 19208 package body SYS.KUPW$WORKER
7000004c9656fe0 8385 package body SYS.KUPW$WORKER
7000004c9656fe0 12748 package body SYS.KUPW$WORKER
7000004c9656fe0 2546 package body SYS.KUPW$WORKER
7000004c9656fe0 9054 package body SYS.KUPW$WORKER
7000004c9656fe0 1688 package body SYS.KUPW$WORKER
7000004c9659720 2 anonymous block
object line object
handle number name
7000004c9656fe0 19208 package body SYS.KUPW$WORKER
7000004c9656fe0 8385 package body SYS.KUPW$WORKER
7000004c9656fe0 12748 package body SYS.KUPW$WORKER
7000004c9656fe0 2546 package body SYS.KUPW$WORKER
7000004c9656fe0 9054 package body SYS.KUPW$WORKER
7000004c9656fe0 1688 package body SYS.KUPW$WORKER
7000004c9659720 2 anonymous block
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.GET_TABLE_DATA_OBJECTS [
ORA-31642: the following SQL statement fails:
BEGIN "SYS"."DBMS_CUBE_EXP".SCHEMA_CALLOUT(:1,0,1,'11.02.00.02.00'); END;
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_METADATA", line 1245
ORA-04063: package body "SYS.DBMS_CUBE_EXP" has errors
ORA-06508: PL/SQL: could not find program unit being called: "SYS.DBMS_CUBE_EXP"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.KUPW$WORKER", line 8353
----- PL/SQL Call Stack -----
object line object
handle number name
7000004c9656fe0 19208 package body SYS.KUPW$WORKER
7000004c9656fe0 8385 package body SYS.KUPW$WORKER
7000004c9656fe0 12748 package body SYS.KUPW$WORKER
7000004c9656fe0 2546 package body SYS.KUPW$WORKER
7000004c9656fe0 9054 package body SYS.KUPW$WORKER
7000004c9656fe0 1688 package body SYS.KUPW$WORKER
7000004c9659720 2 anonymous block
Job "BAW"."SYS_EXPORT_SCHEMA_01" stopped due to fatal error at 16:07:26
eThe simple solution to this problem is, and its working perfectly with me on 11gR2 resolving the subject error.
To avoid this problem, perform relational exports excluding OLAP's Analytic Workspaces.
1) Remove workspace package from export:
a. Connect sys/password as sysdba
b. create table sys.exppkgact$_backup as select * from sys.exppkgact$;
(Backup package before deleting it)
c. delete from sys.exppkgact$ where package = 'DBMS_CUBE_EXP' and schema= 'SYS';
d. commit;
4) Run the export. -
Errors for PACKAGE BODY WWV_FLOW_CUSTOM_AUTH_SSO
Hi All,
Running the below package so I can configure SSO...running into the below error.
Any help is appreciated
SQL> @custom_auth_sso_902.plb;
...wwv_flow_custom_auth_sso
Warning: Package Body created with compilation errors.
Errors for PACKAGE BODY WWV_FLOW_CUSTOM_AUTH_SSO:
LINE/COL ERROR
0/0 PL/SQL: Compilation unit analysis terminated
1/14 PLS-00304: cannot compile body of 'WWV_FLOW_CUSTOM_AUTH_SSO'
without its specificationYou need to ask Apex related questions in the Apex forum.
Include the 4 digit Oracle and Apex versions you are using when you post your problem.
I assume that you have read how to implement SSO for Apex applications to be partner applications for Oracle App Server single sign-on authentication? If not, I suggest that you search http://tahiti.oracle.com for the relevant instructions. (cannot recall the exact manual reference - I did this 3 or 4 years ago myself) -
EA 3.0 returns error on compiling of package body
Hi,
I got the following error
Error: ORA-06550: line 1, column 64:
PLS-00172: string literal too long
when I was trying to compile package body.
In previous version of SQL DEV the package is compiled without any problems.
I have a procedure in package with more than 120 parameters.
Edited by: user635344 on Oct 15, 2010 10:54 AMThis problem is a bug : SQL*Developer 3EA1 - Not Compiling package Body
regards Karsten -
How can i find start line of any functions or procedures stored in package body?
hi
how can i find start line of any functions or procedures stored in package body?
is there any way to write a query from for example user_source?
thankshow can i find start line of any functions or procedures stored in package body?
Why? What will you do differently if a procedure starts on line 173 instead of line 254?
Tell us what PROBLEM you are trying to solve so we can help you find the best way to solve it.
If you use PL_SCOPE that info is available in the *_IDENTIFIERS views. See 'Using PL/Scope in the Advanced Dev Doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28424/adfns_plscope.htm
Try this simple sample code. The query is modified from that doc sample:
-- tell the compiler to collect the info
ALTER SESSION SET PLSCOPE_SETTINGS='IDENTIFIERS:ALL';
-- recompile the package
CREATE OR REPLACE package SCOTT.pack1 as
PROCEDURE proc1;
PROCEDURE proc2;
END;
CREATE OR REPLACE package BODY SCOTT.pack1 as
PROCEDURE proc1 IS
BEGIN
NULL;
END;
PROCEDURE proc2 IS
BEGIN
proc1;
END;
PROCEDURE proc3 IS
BEGIN
proc1;
proc2;
END;
END;
-- query the info for the package spec
WITH v AS (
SELECT Line,
Col,
INITCAP(NAME) Name,
LOWER(TYPE) Type,
LOWER(USAGE) Usage,
USAGE_ID,
USAGE_CONTEXT_ID
FROM USER_IDENTIFIERS
WHERE Object_Name = 'PACK1'
AND Object_Type = 'PACKAGE'
SELECT LINE, RPAD(LPAD(' ', 2*(Level-1)) ||
Name, 20, '.')||' '||
RPAD(Type, 20)||
RPAD(Usage, 20)
IDENTIFIER_USAGE_CONTEXTS
FROM v
START WITH USAGE_CONTEXT_ID = 0
CONNECT BY PRIOR USAGE_ID = USAGE_CONTEXT_ID
ORDER SIBLINGS BY Line, Col
LINE,IDENTIFIER_USAGE_CONTEXTS
1,Pack1............... package declaration
2, Proc1............. procedure declaration
3, Proc2............. procedure declaration
-- query the info for the package body - change 'PACKAGE' to 'PACKAGE BODY' in the query above
LINE,IDENTIFIER_USAGE_CONTEXTS
1,Pack1............... package definition
2, Proc1............. procedure definition
6, Proc2............. procedure definition
8, Proc1........... procedure call
10, Proc3............. procedure declaration
10, Proc3........... procedure definition
12, Proc1......... procedure call
13, Proc2......... procedure call
Maybe you are looking for
-
File download/upload howto
Regarding the Fil upload/download at http://www.oracle.com/technology/products/database/htmldb/howtos/howto_file_upload.html How can I add a 'Delete' button next to each file in the Download report region to delete that file from the wwv_flow_files t
-
Newbie question about entity and view objects
Hi everyone, My first ADF application in JDeveloper is off to a difficult start. Having come from a forms background, I know that it is necessary avoid using post-query type lookups in order to have full filtering using F11/Ctrl+F11. This means creat
-
Adobe Reader 11 MUI Spell check?
Hello, Where can I find the list of all supported languages for spell check? I saw one for Adobe Reader 9 but not one listed for 10 and 11. Am I to assume that is the same list? Does the spell check apply to any Asian language, like both Chinese, k
-
What do I do about Error 1328 when installing Adobe reader
When I try to install Adobe reader on my computer (Windows 7) Error 1328: Can't patch C:\Config.Msi\PT4921.temp appears. What can I do to get around this problem?
-
IOS 5.1.1 asking microphone dication
my iphone 4 ios 5 .1.1 asking micro phone dictation to procced [ SAYING LIKE THIS WHEN YOU TAP THE MICROPHONE BOTTON ON THE KEYBOARD WHAT YOU SAY WIIL BE CONVERTED TO TEXT DICTATION WORKS WITH ANY APP WITH A KEYBOARD? iam unable understand what is i