How can I eliminate HTML tags from Oracle Text Snippet?
I perform a search on many tables and on many columns of those tables.
Some of those columns are VARCHAR2 and some CLOB.
Also, some of the searchable data are HTML and some are plain text.
My problem is that ctx_doc.snippet fetches the HTML tags.
For example I get this, as a snippet result in one of my searches: Qual Germany n1 <p>Test Qual Germany n1</p>
I want the result to be fetched without the HTML tags.
In my index configuration I have used NULL FILTER and HTML_SECTION_GROUP.With that configuration I managed to eliminate the HTML tags but not in all cases!
For example:
I search table CONTENTS columns TITLE(VARCHAR2) and MAIN_TEXT(CLOB)
I created the following procedure that concatenates the two columns:
CREATE OR REPLACE PROCEDURE CONTENTS_PROC( p_id in rowid, p_lob IN OUT clob)
IS
BEGIN
FOR c1 IN (SELECT main_text||' '||title data FROM contents WHERE ROWID = p_id)
LOOP
dbms_lob.copy( p_lob, c1.data,
dbms_lob.getlength( c1.data ));
END LOOP;
END;
I created a user Datastore:
BEGIN
ctx_ddl.create_preference( 'content_trans_datastore', 'user_datastore' );
ctx_ddl.set_attribute( 'content_trans_datastore', 'procedure', 'CONTENTS_PROC' );
END;
and finally I create the index:
CREATE INDEX content_trans_ot_idx ON contents(ORACLE_TEXT_COLUMN)
INDEXTYPE IS ctxsys.CONTEXT PARAMETERS ('datastore content_trans_datastore SYNC(ON COMMIT) STORAGE INDEX_STORAGE filter ctxsys.null_filter section group ctxsys.html_section_group');
When I perform the search on those data: <p> <strong>Test Doc-Test </strong> </p> the snippet I get is: Test Doc-Test.
That's fine, the html tags are removed!
In another case I search table NCP columns NAME(VARCHAR2) and BODY(VARCHAR2)
I created the following procedure that concatenates the two columns:
CREATE OR REPLACE PROCEDURE NCP_PROC( p_id in rowid, p_lob IN OUT clob)
IS
BEGIN
FOR c1 IN (SELECT name||' '||body data FROM ncp WHERE ROWID = p_id)
LOOP
dbms_lob.copy( p_lob, c1.data,
dbms_lob.getlength( c1.data ));
END LOOP;
END;
I created a user Datastore:
BEGIN
ctx_ddl.create_preference( 'ncp_trans_datastore', 'user_datastore' );
ctx_ddl.set_attribute( 'ncp_trans_datastore', 'procedure', 'NCP_PROC' );
END;
and finally I create the index:
CREATE INDEX ncp_trans_ot_idx ON ncp(ORACLE_TEXT_COLUMN)
INDEXTYPE IS ctxsys.CONTEXT PARAMETERS('datastore ncp_trans_datastore SYNC(ON COMMIT) STORAGE INDEX_STORAGE filter ctxsys.null_filter section group ctxsys.html_section_group');
When I perform the search on those data: test <strong> </strong>http://deleteme.com the snippet I get is: test <strong> </strong>http://deleteme.com!!!!!!!!!!
How is this possible? Why in the first case the HTML tags are eliminated and in the second case they are not?
Thanks,
Margarita
Edited by: user13312701 on 07-Sep-2010 08:51
Doing various tests I found out that the problem is when I need to search in multiple columns of a table.
That is when I create a user_datastore that uses a procedure that concatenates the columns.
And especially when the data with the html tags is in a VARCHAR2 column.
e.g
--create the table*
CREATE TABLE CONTENT_TRANS (content_trans_id NUMBER,
main_text CLOB,
title vARCHAR2(2000),
oracle_text_column VARCHAR2(1));
alter table "CONTENT_TRANS" add constraint CONTENT_PK primary key("CONTENT_TRANS_ID") ;
--Insert dummy data*
Insert into CONTENT_TRANS
(CONTENT_TRANS_ID,MAIN_TEXT,TITLE)
values
(1,'lorem','lorem <p>qualification</p> 2.1 ');
Insert into CONTENT_TRANS
(CONTENT_TRANS_ID,MAIN_TEXT,TITLE)
values
(2,'lorem','lorem <br>qualification</br> 2.1 ');
--CREATE THE procedure that concatenates main_text(CLOB) and title(VARCHAR2)*
CREATE OR REPLACE PROCEDURE CONTENT_TRANS_PROC( p_id in rowid, p_lob IN OUT clob)
IS
BEGIN
FOR c1 IN (SELECT main_text||' '||title data FROM content_trans WHERE ROWID = p_id)
LOOP
dbms_lob.copy( p_lob, c1.data,
dbms_lob.getlength( c1.data ));
END LOOP;
END;
--Create the user datastore*
BEGIN
ctx_ddl.create_preference( 'content_trans_datastore', 'user_datastore' );
ctx_ddl.set_attribute( 'content_trans_datastore', 'procedure', 'CONTENT_TRANS_PROC' );
END;
--Create the index*
CREATE INDEX content_trans_ot_idx ON content_trans(ORACLE_TEXT_COLUMN)
INDEXTYPE IS ctxsys.CONTEXT PARAMETERS ('datastore content_trans_datastore SYNC(ON COMMIT) filter ctxsys.null_filter section group ctxsys.html_section_group');
exec ctx_doc.set_key_type('PRIMARY_KEY');
--Perform the query
SELECT SCORE(1),ct.content_trans_id, ctx_doc.snippet('content_trans_ot_idx', ct.content_trans_id, 'lorem') as snippet
from content_trans ct
where contains(ct.ORACLE_TEXT_COLUMN, 'lorem', 1) > 1;
Results WITH NOT WANTED HTML TAGS:
6 1 <b>lorem</b> <b>lorem</b> <p>qualification</p> 2.1
6 2 <b>lorem</b> <b>lorem</b> <br>qualification</br> 2.1
Edited by: user13312701 on 13-Oct-2010 01:18
Similar Messages
-
How can I remove people tags from MULTIPLE images in Organizer 13?
How can I remove people tags from MULTIPLE images in Organizer 13? The strategy for removing keyword tags does not work. It appears that keyword tags and People tags are considered something completely different in 13. I highlight multiple images, right click, and under keyword tags it says there are no keyword tags. There does not appear to be an option for people or other tags. Can anyone help? It is going to take literally hundreds of hours for me to do this one photo one tag at a time. ??
Comp. 792 wrote:
Hi, my linked images all have dashed lines at the bottom of the images. I searched for an answer and someone said to add:
img a {text-decoration:none:}
to the end of my CSS,
That CSS is complete nonsense. The correct way to remove borders from around links is here: http://forums.adobe.com/thread/417110.
If you want to get rid of dotted lines, they are almost certainly caused by the outline property. However, outlines around links are there for a reason: it provides a visual "you are here" clue to people who navigate the web with the keyboard, either through preference or because of disability. You shouldn't remove the dotted outline without providing a different visual clue. -
Remove HTML tags from a text area
Hi, here is my problem:
I have a form with a text area item; this item is “Display as Editor HTML standard”. So it is possible to enter formatted text with tags HTML. Then I save the text in a table. In the column the text maintain the HTML tags. Afterwards I can put the text in a report, and I can see the formatted text with the tags HTML interpreted.
But I need also to use that text for other aims, (i.e. sending it in a mail) with the html tags removed.
Is there any way to remove HTML tags from a text item?
Regards
DarioFrom http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:769425837805
FUNCTION str_html (line IN VARCHAR2)
RETURN VARCHAR2
IS
x VARCHAR2 (32767) := NULL;
in_html BOOLEAN := FALSE;
s VARCHAR2 (1);
BEGIN
IF line IS NULL
THEN
RETURN line;
END IF;
FOR i IN 1 .. LENGTH (line)
LOOP
s := SUBSTR (line, i, 1);
IF in_html
THEN
IF s = '>'
THEN
in_html := FALSE;
END IF;
ELSE
IF s = '<'
THEN
in_html := TRUE;
END IF;
END IF;
IF NOT in_html AND s != '>'
THEN
x := x || s;
END IF;
END LOOP;
RETURN x;
END str_html;There's also a reqular expression approach that I've not tried. Remove HTML Tags and parse the text out of it -
How can I extract Java source from Oracle?
I have an object of type "JAVA SOURCE" in my database. I do not have the source
code available.
How can I extract this source from the database so I can read it? I am not a Java programmer, so a sql or pl/sql solution would be greatly appreciated.
Thanks in advance!This query lists any Java object that the current database user has (JAVA SOURCE, JAVA CLASS or JAVA RESOURCE). Use this to determine which Java sources exist.
SELECT * FROM USER_OBJECTS
WHERE OBJECT_TYPE LIKE 'JAVA%'This query lists the source of one Java object.
SELECT * FROM USER_SOURCE
WHERE TYPE = 'JAVA SOURCE'
AND NAME = 'com/acme/HelloWorld'Substitue the name of the java class you're interested in for 'com/acme/HelloWorld'.
I know that the question is four years old, but I had the same question and arrived here via Google, so I figured posting an answer might help others in a similar situation. -
How to remove html-tags from a text.
Hello!
I have a text-field which I will remove html-tag's from.
Example:
"This is a test<br><p> and another test"
The function must return a similar text, but without the html-
tags <br> and <p> (in this case).
Anybody that can help me with this little problem?
Thanks in advance for any help :-)
Best regards
Kjetil KlxveYou can wait for some kind personal to post a complete code
solution... But if you want to fix this yourself (which is good
for the soul) here are some hints:
- You can use SUBSTR to get at chunks of text
- You can use INSTR to find particular characters.
- You can use INSTR as an argument of SUBSTR
Hence:
bit_of_text := SUBSTR(text, 1, INSTR(text, '<'));
chopped_text := SUBSTR(text, INSTR(text, '<'));
bit_of_text := bit_of_text||SUBSTR(chopped_text, INSTR
(text, '>'), INSTR(text, '<'));
will give you the first bit of text that doesn't contain any
angle brackets.
From this you should be able to work out how to functionalised
this (you'll need to store the offsets and use them in a loop
construct).
Note that this assumes that the text only contains the '<'
character when it's part of a HTML tag. If you can't guarantee
this then you'll have to explicitly search for all the tags e.g.
bit_of_text := SUBSTR(text, 1, INSTR(lower(text), '<p>'));
bit_of_text := SUBSTR(text, 1, INSTR(lower(text), '<br>'));
This will be a bit of pain. And completely rules out XML!
rgds APC -
How can I use unix commands from oracle report
I have to use the following command from oracle reports.
In oracle forms we can use the HOST command but what about oracle reports2.5.
I have to email the attached file 100245.pdf from oracle reports to the given email id
uuencode 100245.pdf 100245.pdf | mailx -s "test" [email protected]Hi,
It's because .bat (or .cmd) files are scripts and not executables and are interpreted using the command line executable - which is normally cmd.exe (although you can buy others).
So you need to call cmd.exe passing the bat file name as a parameter, something like
cmd.exe /c batchfilename
Without the /c you will never get a response.
However, this brings us to the bizarre conclusion that you are going to:
call cmd.exe (a shell interpreter)
to launch a batch file
that calls cygwin (another shell interpreter)
which then runs ls
When shouldn't that just be:
call cmd.exe to run the dir command
Or better yet, If you are just after a file name listing and you seem to understand Java stored procs, why not just write a JSP to list the contents of a directory? No problems with OS dependant commands, scripts and 3rd party interpreters. Plenty of examples of that out on the internet as well.
HTH
Chris -
I got a new computer and installed Elements 9.0 on it. I am retrieving the pics from my old hard drive just fine but I seem to have lost the majority of my old keyword tags. Any help? Thanks.
If you didn't write the keyword tags to all the photos when your old computer was working, you can't get the tags back by simply retrieving the photos.
You'll need to retrieve the entire catalog directory. When you open that old catalog on your new computer, all your photos will be listed as "missing". Use the Reconnect All Missing Files to connect them by browsing to their current location.
Ken -
Problem removing html tags from the text retrived
Hi there,
I am using jdbc to connect the database and retriving the data. In one of the columns along with the description there are some html tags in few of the recors of that column. is there a way to retrive the text only ignoring the html tags in between. Or can i retrive and then strip off the html code in the text to display only normal text.
example of the data retrived which are pipe seperated and one of the columns has html tags in it:
209|The euphoria |187945-2|http://www.abc/lst.jsp?mktgChannel=I86023&sku=18791-2&siteID=qpF0HYnRugA|http://www.abc.com/assets/images/product/medium/18793-2_198.jpg|Rooftop Singers: Walk Right In | abc Music proudly presents THE FOLK YEARS, an unforgettable era in music history!<BR><BR><B>Featuring:</B><BR>
<LI>The most complete collection of folk and folk-rock songs ever put together -- 132 classics!
<LI>Original hits by the original artists!
Now i need to remove the tags before displaying this on the output. Is there a simple way to do this.
Thanks...Did you read the documentation of the trim() method,
where it describes which whitespace it removes?I believe his problem is that
"Some text here
<blah>
More text"becomes
"Some text here
More text"... and he wants ...
"Some text here
More text"So, your problem is that your regex isn't matching whitespace as well.
See the "Trimming Whitespace" section:
http://www.regular-expressions.info/examples.html -
How can i copy and paste from applet text controls
we are using applet text box how can we copy paste from this text box to other applications
I'm not 100% sure, but shouldn't it be working by default, using CTRL+C or whichever keystroke is needed?
-
How can i eliminate the unnecessary symbols and text in matrix report
Hi,
I have create one matrix report using report wizard but that is displaying some boxes including data and the text which i have to display one time,but that is displaying more times.Can anybody suggest how can i format my layout.I also would like to add some morecolumn within that layout is it possible?
Thankshi Ravi,
Thanks for ur reply.I have tried like that also but i am getting something symbols like box[segment1]m like that.Actually i am running that report on oracle apps.there i am getting like that.But in the report builder side its fine.What may be the cause?Can u please suggest me
Thanks -
How can I remove the underline from added text for tracing edits
We have a lot of content that includes underscores and when we use the track text edit feature added text is green and underlined. How can I change the properties of the added text to not be underlined?
Starting with FM11, you could specify a custom colour to be used for track changes, but the styles (underline, strikethrough) are still hardwired.
Even if you try to make the changes to the rack text edit conditions in a MIF file, they will get overwritten as the MIF is interpreted when opened by FM.
Please use the new Bugs & Features form to submit an enhancement request: https://bugbase.adobe.com/index.cfm -
How can i delete a UserName from a text file using Strings or io.
hi i m trainee
i have been assigned to make java program which deletes a UserName and
his Passwor from a Text File
i m unable to do it using the code below
plz help
do reply
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java .applet.*;
import java.io.*;
class Del extends JFrame implements ActionListener
String s2;
JTextField CWDMUserDText = new JTextField();
JButton CWDMSecDelButton = new JButton("DELETE");
JLabel CWDMUserLabel = new JLabel("USER NAME");
JPasswordField CWDMPassDText = new JPasswordField();
JLabel CWDMPassLabel = new JLabel("PASSWORD");
//String user,pass;
/* CONSTRUCTOR*/
Del()
Container contentPane=getContentPane();
contentPane.setLayout(null);
setLocation(400,200);
contentPane.add(CWDMUserDText);
contentPane.add(CWDMSecDelButton);
contentPane.add(CWDMUserLabel);
contentPane.add(CWDMPassDText);
contentPane.add(CWDMPassLabel);
CWDMUserLabel.setBounds(20,70,100,25);
CWDMPassLabel.setBounds(20,100,100,25);
CWDMUserDText.setBounds(150,70,100,25);
CWDMPassDText.setBounds(150,100,100,25);
CWDMSecDelButton.setBounds(80,135,100,25);
CWDMUserDText.addActionListener(this);
CWDMPassDText.addActionListener(this);
CWDMSecDelButton.addActionListener(this);
contentPane.setBackground(Color.CYAN);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
public void actionPerformed(ActionEvent ae)
if(ae.getSource()==CWDMSecDelButton)
// user = CWDMUserDText.getText();
// pass = CWDMPassDText.getText();
// showarr();
s2 = CWDMUserDText.getText();
CWDMUserDText.setText("");
CWDMPassDText.setText("");
DelUser(s2);
public static void main(String args[])
Del myframe1= new Del();
myframe1.setSize(300,200);
myframe1.setVisible(true);
public void DelUser(String s)
//int a;
try
FileReader fr = new FileReader("file.txt");
BufferedReader br = new BufferedReader(fr);
String s1;
int a;
int len = s.length();
System.out.println(len);
//s2 = CWDMUserDText.getText();
while ((s1=br.readLine()) !=null)
if((a=s1.indexOf(s))>0 && (a=s1.indexOf(s))!=0)
System.out.println(a);
fr.close();
catch(FileNotFoundException e)
System.out.println("exception occured");
catch(IOException e)
System.out.println("io");
}Some tips:
1) If you are adding or deleting stuff from a text file you need to write a new, modified file and then, optionally, do something like:
rename the old file to whatever.bak or the like.
rename the new file to the old.
2) Don't depend on System.out so much on a GUI application. For example if you get an exception use javax.swing.JOptionPane to display an alert (and show the message from the exception). You can write the stack trace to System.out if you want.
3) Don't muck about with calculating bounds for screen objects, let a layout manager sort it out. I like BoxLayoutManager for most things like this.
4) For bonus points do your IO in a separate Thread. Generally you don't want anything happening in an actionPerformed method which significantly delays it's return. The method should launch a new Thread to do the job, and disable the button until the Thread finishes. -
Sending Unicode HTML email from Oracle
Dear All,
How we can send the HTML email from Oracle in Unicode format (I am using Arabic Language, to be specific). So far I have tried the following solutions (using utl_smpt) without any success (either i see junk characters in the email or see question marks). Would you please help me in solving this?
Options Tried*
Option 1
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE p_send_mail_test (
2 sender IN VARCHAR2,
3 recipient IN VARCHAR2,
4 subj IN VARCHAR2,
5 message IN VARCHAR2)
6 IS
7 mailhost VARCHAR2(30) := '<smtp Server>';
8 c utl_smtp.connection;
9 PROCEDURE send_header( name IN VARCHAR2, header IN VARCHAR2) AS
10 BEGIN
11 utl_smtp.write_data(c, name || ': ' || header || utl_tcp.CRLF);
12 END;
13 BEGIN
14 c := utl_smtp.open_connection(mailhost,25);
15 utl_smtp.helo(c, mailhost);
16 utl_smtp.mail(c, sender);
17 utl_smtp.rcpt(c, recipient);
18 utl_smtp.open_data(c);
19 send_header('From', sender);
20 send_header('To', recipient);
21 -- If you need to send mail to more than one receipient, uncomment the
22 -- following line(s) as appropriate. Please don't forget the ","
23 -- in the "To" line before the next receipient's email id. You can't
24 -- use a comma separated list in the receipient parameter.
25 -- For variable number of "To"'s and "Cc"'s have multiple calls to
26 -- "send_header" function inside a cursor for loop.
27 -- Similar comments apply for "Cc" too.
28 -- send_header('To', ',<email@domain>');
29 send_header('Cc', ',<email@domain>');
30 send_header('Subject', subj);
31 utl_smtp.write_data(c, utl_tcp.CRLF || message);
32 utl_smtp.close_data(c);
33 utl_smtp.quit(c);
34 EXCEPTION
35 WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
36 utl_smtp.quit(c);
37 raise_application_error(-20000,
38 'Failed to send mail due to the following error: ' || sqlerrm);
39* END;
SQL>
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى <br/>.ولكم جزيل الشكر والتقدير </font></div>';
7 p_send_mail_test('<email@domain>','<email@domain>','Hello',email_text);
8* end;
SQL> /
PL/SQL procedure successfully completed.
Result_
<div align="right"><font size="4"><b>????? Riaz ???????</b>
???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
.???? ???? ????? ???????? </font></div>
[Question marks along with all tags; this OTN page is converting that to HTML output]
Option2
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure html_email(
2 p_to in varchar2,
3 p_from in varchar2,
4 p_subject in varchar2,
5 p_text in varchar2 default null,
6 p_html in varchar2 default null
7 )
8 is
9 l_boundary varchar2(255) default 'a1b2c3d4e3f2g1';
10 l_connection utl_smtp.connection;
11 l_body_html clob := empty_clob; --This LOB will be the email message
12 l_offset number;
13 l_ammount number;
14 l_temp varchar2(32767) default null;
15 l_smtp_hostname varchar2(50) := '<smtp Server>';
16 begin
17 l_connection := utl_smtp.open_connection( l_smtp_hostname, 25);
18 utl_smtp.helo( l_connection, l_smtp_hostname );
19 utl_smtp.mail( l_connection, p_from );
20 utl_smtp.rcpt( l_connection, p_to );
21 l_temp := l_temp || 'MIME-Version: 1.0' || chr(13) || chr(10);
22 l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
23 l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
24 l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
25 l_temp := l_temp || 'Reply-To: ' || p_from || chr(13) || chr(10);
26 l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
27 chr(34) || l_boundary || chr(34) || chr(13) ||
28 chr(10);
29 ----------------------------------------------------
30 -- Write the headers
31 dbms_lob.createtemporary( l_body_html, false, 10 );
32 dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
33 ----------------------------------------------------
34 -- Write the text boundary
35 l_offset := dbms_lob.getlength(l_body_html) + 1;
36 l_temp := '--' || l_boundary || chr(13)||chr(10);
37 l_temp := l_temp || 'content-type: text/plain;charset=utf-8' ||
38 chr(13) || chr(10) || chr(13) || chr(10);
39 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
40 ----------------------------------------------------
41 -- Write the plain text portion of the email
42 l_offset := dbms_lob.getlength(l_body_html) + 1;
43 dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
44 ----------------------------------------------------
45 -- Write the HTML boundary
46 l_temp := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
47 chr(13) || chr(10);
48 l_temp := l_temp || 'content-type: text/html;charset=utf-8' ||
49 chr(13) || chr(10) || chr(13) || chr(10);
50 l_offset := dbms_lob.getlength(l_body_html) + 1;
51 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
52 ----------------------------------------------------
53 -- Write the HTML portion of the message
54 l_offset := dbms_lob.getlength(l_body_html) + 1;
55 dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
56 ----------------------------------------------------
57 -- Write the final html boundary
58 l_temp := chr(13) || chr(10) || '--' || l_boundary || '--' || chr(13);
59 l_offset := dbms_lob.getlength(l_body_html) + 1;
60 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
61 ----------------------------------------------------
62 -- Send the email in 1900 byte chunks to UTL_SMTP
63 l_offset := 1;
64 l_ammount := 1900;
65 utl_smtp.open_data(l_connection);
66 while l_offset < dbms_lob.getlength(l_body_html) loop
67 utl_smtp.write_data(l_connection,
68 dbms_lob.substr(l_body_html,l_ammount,l_offset));
69 l_offset := l_offset + l_ammount ;
70 l_ammount := least(1900,dbms_lob.getlength(l_body_html) - l_ammount);
71 end loop;
72 utl_smtp.close_data(l_connection);
73 utl_smtp.quit( l_connection );
74 dbms_lob.freetemporary(l_body_html);
75* end;
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى <br/>.ولكم جزيل الشكر والتقدير </font></div>';
7 html_email(p_to=>'<email@domain>',p_from=>'<email@domain>',p_subject=>'Hello',p_text=>'Hi', p_html=>email_text);
8* end;
SQL> /
PL/SQL procedure successfully completed.
Result*
????? Riaz ???????
???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
Option3
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure p_html_email_riaz(
2 p_to in varchar2,
3 p_from in varchar2,
4 p_subject in varchar2,
5 p_text in varchar2 default null,
6 p_html in varchar2 default null
7 )
8 is
9 l_boundary varchar2(255) default 'a1b2c3d4e3f2g1';
10 l_connection utl_smtp.connection;
11 l_body_html clob := empty_clob; --This LOB will be the email message
12 l_offset number;
13 l_ammount number;
14 l_temp varchar2(32767) default null;
15 l_smtp_hostname varchar2(50) := '<smtp Server>';
16 begin
17 l_connection := utl_smtp.open_connection( l_smtp_hostname, 25);
18 utl_smtp.helo( l_connection, l_smtp_hostname );
19 utl_smtp.mail( l_connection, p_from );
20 utl_smtp.rcpt( l_connection, p_to );
21 l_temp := l_temp || 'MIME-Version: 1.0' || chr(13) || chr(10);
22 l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
23 l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
24 l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
25 l_temp := l_temp || 'Reply-To: ' || p_from || chr(13) || chr(10);
26 l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
27 chr(34) || l_boundary || chr(34) || chr(13) ||
28 chr(10);
29 ----------------------------------------------------
30 -- Write the headers
31 dbms_lob.createtemporary( l_body_html, false, 10 );
32 dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
33 ----------------------------------------------------
34 -- Write the text boundary
35 l_offset := dbms_lob.getlength(l_body_html) + 1;
36 l_temp := '--' || l_boundary || chr(13)||chr(10);
37 l_temp := l_temp || 'content-type: text/plain; charset=UTF-8' ||
38 chr(13) || chr(10) || chr(13) || chr(10);
39 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
40 ----------------------------------------------------
41 -- Write the plain text portion of the email
42 /**
43 l_offset := dbms_lob.getlength(l_body_html) + 1;
44 dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
45 **/
46 ----------------------------------------------------
47 -- Write the HTML boundary
48 l_temp := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
49 chr(13) || chr(10);
50 l_temp := l_temp || 'content-type: text/html;' ||
51 chr(13) || chr(10) || chr(13) || chr(10);
52 l_offset := dbms_lob.getlength(l_body_html) + 1;
53 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
54 ----------------------------------------------------
55 -- Write the HTML portion of the message
56 l_offset := dbms_lob.getlength(l_body_html) + 1;
57 dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
58 ----------------------------------------------------
59 -- Write the final html boundary
60 l_temp := chr(13) || chr(10) || '--' || l_boundary || '--' || chr(13);
61 l_offset := dbms_lob.getlength(l_body_html) + 1;
62 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
63 ----------------------------------------------------
64 -- Send the email in 1900 byte chunks to UTL_SMTP
65 l_offset := 1;
66 l_ammount := 1900;
67 utl_smtp.open_data(l_connection);
68 while l_offset < dbms_lob.getlength(l_body_html) loop
69 utl_smtp.write_raw_data(l_connection,
70 utl_raw.cast_to_raw(
71 dbms_lob.substr(l_body_html,l_ammount,l_offset ) ) );
72 l_offset := l_offset + l_ammount ;
73 l_ammount := least(1900,dbms_lob.getlength(l_body_html) - l_ammount);
74 end loop;
75 utl_smtp.close_data(l_connection);
76 utl_smtp.quit( l_connection );
77 dbms_lob.freetemporary(l_body_html);
78* end;
SQL>
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى <br/>.ولكم جزيل الشكر والتقدير </font></div>';
7 p_html_email_riaz(p_to=>'<email@domain>',p_from=>'<email@domain>',p_subject=>'Hello',p_text=>'Hi', p_html=>email_text);
8* end;
SQL> /
PL/SQL procedure successfully completed.
Result*
GaSmO Riaz GacMJQc
mQLl GaJ_Qc HGaZac Cd GaZ^O GaNGU H_c SmdJem HJGQmN 12-07-2011
. fZame mQL\l GaJ_\Qc HE]GOI EOGQI GacfGQO GaHTQmI ]m MGa ZOc Q[HJ_c HJLOmO GaZ^O NaGa cOI C^UeG CSHfZmd cd Gamfc fPa_ aaCecmI Ga^Ufl
.fa_c LRma GaT_Q fGaJ^OmQ
*Option4*
[code]
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE send_email_html_test(
2 pi_from IN Varchar,
3 pi_to IN VARCHAR,
4 pi_cc IN Varchar,
5 pi_subj IN VARCHAR,
6 pi_msg CLOB
7 )
8 IS
9 conn utl_smtp.connection;
10 lv_mailhost varchar2(1000);
11 lv_port number;
12 BEGIN
13 lv_mailhost := '<smtp Server>';
14 lv_port := 25;
15 conn := utl_smtp.open_connection(lv_mailhost, lv_port);
16 utl_smtp.helo(conn, lv_mailhost);
17 utl_smtp.mail(conn, pi_from);
18 utl_smtp.rcpt(conn, pi_to);
19 IF pi_cc is not null THEN
20 utl_smtp.rcpt(conn, pi_cc);
21 END IF;
22 utl_smtp.open_data(conn);
23 utl_smtp.write_data(conn, 'MIME-version: 1.0' || utl_tcp.CRLF);
24 utl_smtp.write_data(conn, 'Content-Type: text/html; charset=iso-8859-6' ||
25 utl_tcp.CRLF);
26 utl_smtp.write_data(conn, 'Content-Transfer-Encoding: 8bit' ||
27 utl_tcp.CRLF);
28 utl_smtp.write_data(conn, 'From:' ||pi_from || utl_tcp.CRLF);
29 utl_smtp.write_data(conn, 'To:' ||pi_to || utl_tcp.CRLF);
30 utl_smtp.write_data(conn, 'Cc:' ||pi_cc || utl_tcp.CRLF);
31 utl_smtp.write_data(conn, 'Reply-To:' ||pi_from || utl_tcp.CRLF);
32 utl_smtp.write_data(conn, 'Subject:' ||pi_subj|| utl_tcp.CRLF);
33 utl_smtp.write_data(conn, utl_tcp.crlf);
34 utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(pi_msg));
35 utl_smtp.close_data(conn);
36 utl_smtp.quit(conn);
37 EXCEPTION WHEN others THEN
38 dbms_output.put_line(sqlerrm);
39* END;
40 /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='
<div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b>
يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'
. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى
.ولكم جزيل الشكر والتقدير </font></div>';
7 send_email_html_test('<email@domain>',
8 '<email@domain>',
9 '<email@domain>',
10 'Hello',email_text);
11* end;
SQL> /
PL/SQL procedure successfully completed.
Result*
Riaz افكحترك
ٍرجٌ افترك بافغفك أل افغد افخاص بك سٍلتمٍ بتارٍخ 12-07-2011
. نغفٍم ٍرجٌ افترك بإادة إدارة افكنارد افبشرٍة ٍ حاف غدك ربتك بتجدٍد افغد خفاف كدة أصما أسبنغٍل كل افٍنك نذف ففأمكٍة افصنٌ
.نفك جزٍف افشر نافتدٍر
Option5
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE send_mail_test1 (p_to IN VARCHAR2,
2 p_from IN VARCHAR2,
3 p_subject IN VARCHAR2,
4 p_text_msg IN VARCHAR2 DEFAULT NULL,
5 p_html_msg IN VARCHAR2 DEFAULT NULL,
6 p_smtp_host IN VARCHAR2,
7 p_smtp_port IN NUMBER DEFAULT 25)
8 AS
9 l_mail_conn UTL_SMTP.connection;
10 l_boundary VARCHAR2(50) := '----=*#abc1234321cba#*=';
11 BEGIN
12 l_mail_conn := UTL_SMTP.open_connection(p_smtp_host, p_smtp_port);
13 UTL_SMTP.helo(l_mail_conn, p_smtp_host);
14 UTL_SMTP.mail(l_mail_conn, p_from);
15 UTL_SMTP.rcpt(l_mail_conn, p_to);
16 UTL_SMTP.open_data(l_mail_conn);
17 UTL_SMTP.write_data(l_mail_conn, 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') || UTL_TCP.crlf);
18 UTL_SMTP.write_data(l_mail_conn, 'To: ' || p_to || UTL_TCP.crlf);
19 UTL_SMTP.write_data(l_mail_conn, 'From: ' || p_from || UTL_TCP.crlf);
20 UTL_SMTP.write_data(l_mail_conn, 'Subject: ' || p_subject || UTL_TCP.crlf);
21 UTL_SMTP.write_data(l_mail_conn, 'Reply-To: ' || p_from || UTL_TCP.crlf);
22 UTL_SMTP.write_data(l_mail_conn, 'MIME-Version: 1.0' || UTL_TCP.crlf);
23 UTL_SMTP.write_data(l_mail_conn, 'Content-Type: multipart/alternative; boundary="' || l_boundary || '"' || UTL_TCP.crlf || UTL_TCP.crlf);
24 IF p_text_msg IS NOT NULL THEN
25 UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
26 UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/plain; charset="utf-8"' || UTL_TCP.crlf || UTL_TCP.crlf);
27 UTL_SMTP.write_data(l_mail_conn, p_text_msg);
28 UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
29 END IF;
30 IF p_html_msg IS NOT NULL THEN
31 UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
32 UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/html; charset="utf-8"' || UTL_TCP.crlf || UTL_TCP.crlf);
33 UTL_SMTP.write_data(l_mail_conn, p_html_msg);
34 UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
35 END IF;
36 UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || '--' || UTL_TCP.crlf);
37 UTL_SMTP.close_data(l_mail_conn);
38 UTL_SMTP.quit(l_mail_conn);
39* END;
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى <br/>.ولكم جزيل الشكر والتقدير </font></div>';
7 send_mail_test1('<email@domain>',
8 '<email@domain>',
9 'Hello',
10 'msg',
11 email_text,
12 '<smtp Server>',
13 25);
14* end;
SQL> /
PL/SQL procedure successfully completed.
Result*
????? Riaz ???????
???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
.???? ???? ????? ????????I worked with Oracle support and was able to find solution. The helping document ids were: 752309.1 & 404389.1
-
How can I eliminate aplications
How can I eliminate free
apps fromI asked because you posted in the Accessibility -> Hearing community area. You might want to try the community area dedicated to your hardware (desktop, notebook, etc.). See https://discussions.apple.com/welcome
-
Can I merge duplicate tags from facial recognition in Elements 11?
How can I merge duplicate tags from facial recognition in Photoshop Elements 11? For example, if I mistakenly created two tags, both called Bill, how can I put all Bill's pictures in one file? I found an answer for previous editions of Photoshop Elements, but Photoshop Elements 11 has changed the organizer so I can't figure out how to do it. Also, it doesn't seem possible to see two sets of tags at the same time - is this a glitch?
OK - I figured it out.
1. Go to Media in the Organizer.
2. Click on View at the top, and click on "Show People in Tag Panel."
3. Click on the name you want to merge - the file name you want to get rid of.
4. Edit > Select All
5. Drag the tag you want to use to the selected photos, so that they have both the old and new tags.
6. In the Keyword Tags pane, click on the old tag, go up to where it says "People Tags." There is a plus and minus sign next to this. Click on the minus sign and click on Delete. The tag you highlighted will be deleted.
Maybe you are looking for
-
After 2 years of not having a PC i recently purchased and ASUS laptop and downloaded iTunes. How can I retrieve my music library? I thought I backed it up on an external hard drive, but I can't import the files to my library... I also still have my
-
Final Cut Pro sluggish with G-Speed drives
We are having major problems with our Final Cut Pro system. We are running 6.01 on a dual 3.0 Ghz Intel with 8 gigs of ram. We have two G-Speed running of off SCSI. Whenever the scratch disk is set to one of the drives Final Cut Pro can barely open a
-
ITunesSetup.exe won't download
The latest version of iTunes wouldn't update properly, so I followed the instructions on this site to totally remove iTunes and any associated programs, restarted my computer (Windows 7), and tried to download iTunes from scratch. As soon as I click
-
Dear All Can you help me How To Use Multiple Currencies in single payroll? with regards User600722
-
Can any one provide any explanations and what I can do to put things right. I cannot get into photoshop Elements 10 at all to do any thing.