How to improve performence of the procedure using regular expressions
Hi all,
I have used substr, instr functions in this procedure .
Kindly tell me how use regular_expressions in this procedure .
/* Formatted on 2011/07/20 17:18 (Formatter Plus v4.8.8) */
PROCEDURE pr_insrt_prcdr_rvne_edit ( --ver 4.4
p_pa_rqst_sid IN NUMBER,
p_err_code OUT NUMBER,
p_err_msg OUT VARCHAR2
IS
v_count NUMBER;
CURSOR error_dtls
IS
SELECT parent_target_table_sid, inbnd_target_table_cid,
target_table_sid
FROM inbnd_278_error
WHERE parent_target_table_sid = p_pa_rqst_sid
AND SUBSTR (error_data_value, INSTR (error_data_value, ':') + 1) IN
('5056', '5031');
CURSOR error_values (
p_target_table_sid inbnd_278_error.target_table_sid%TYPE
IS
SELECT MAX (DECODE (SUBSTR (error_data_value,
INSTR (error_data_value, ':', 1) + 1
'5056', SUBSTR (error_data_value,
1,
INSTR (error_data_value, ':', 1) - 1
) AS e5056,
MAX (DECODE (SUBSTR (error_data_value,
INSTR (error_data_value, ':', 1) + 1
'5031', SUBSTR (error_data_value,
1,
INSTR (error_data_value, ':', 1) - 1
) AS e5031
FROM inbnd_278_error
WHERE target_table_sid = p_target_table_sid
AND SUBSTR (error_data_value, INSTR (error_data_value, ':', 1) + 1) IN
('5056', '5031');
v_error_values error_values%ROWTYPE;
BEGIN
p_err_code := 0;
p_err_msg := 'Success';
FOR curr_error_dtls_rec IN error_dtls
LOOP
OPEN error_values (curr_error_dtls_rec.target_table_sid);
FETCH error_values
INTO v_error_values;
IF (v_error_values.e5056 IS NOT NULL
AND v_error_values.e5031 IS NOT NULL
THEN
DELETE FROM inbnd_278_error
WHERE SUBSTR (error_data_value,
INSTR (error_data_value, ':') + 1
) IN ('5056', '5031')
AND target_table_sid = curr_error_dtls_rec.target_table_sid
AND inbnd_target_table_cid = 109;
INSERT INTO inbnd_278_error
(inbnd_278_error_sid,
parent_target_table_sid, inbnd_target_table_cid,
target_table_sid, meta_data_cid,
error_data_value,
created_by, created_date
VALUES (inbnd_278_error_seq.NEXTVAL,
curr_error_dtls_rec.parent_target_table_sid, 109,
curr_error_dtls_rec.target_table_sid, 161,
v_error_values.e5056
|| ','
|| v_error_values.e5031
|| ':'
|| '5059',
1, SYSDATE
END IF;
CLOSE error_values;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
p_err_code := SQLCODE;
p_err_msg :=
'Error occured in pr_insrt_prcdr_rvne_edit procedure '
|| SUBSTR (SQLERRM, 1, 100);
END pr_insrt_prcdr_rvne_edit;
Thanks,
P Prakash
Edited by: prakash on Jul 20, 2011 4:48 AM
Yes as explained in the forum FAQ which you should read
http://forums.oracle.com/forums/ann.jspa?annID=1535
*2. How do I ask a question on the forums?*
SQL and PL/SQL FAQ
And the section beginning.
*9) Formatting with {noformat}{noformat} Tags*
Similar Messages
-
Procedure using regular expression
How to write a procedure using regular expression where i pass a string as input
The procedure should check whether it is a valid email address or not
Please help meHello,
perhaps you don't need to code it, because it's already there.
When you use the database to send your mails it or the appropriate package throws the exception
ORA-29279: Permanenter SMTP-Fehler: 501 5.5.4 Invalid Address
When you just need a procedure to check it you can write a wrapper for a java function.
import javax.mail.internet.*;
import oracle.sql.NUMBER;
public class mail_utility {
public static NUMBER validate_address(String rfc822Address) {
int rc = 0;
try {
InternetAddress ia = new InternetAddress(rfc822Address);
rc = 1;
} catch (AddressException ae) {
rc = 0;
} catch (Exception e) {
rc = -1;
} finally {
return new NUMBER(rc);
CREATE OR REPLACE FUNCTION VALIDATE_ADDRESS (p_address in varchar2)
return number
as language java name
'mail_utility.validate_address(java.lang.String) return oracle.sql.NUMBER';I think i've got it from the forum but i don't remember from whom.
Bernd -
Requirement to update a column by using Regular Expression
Hi All,
I have a requirement to update a column which is having values like below code.
based on the conditinos I need to update from ‘E’ to ‘Z’. Few positions I need to update and remaining positions I need leave as it is.
How I can achive this requirement by using regular expression regexp_replace.
Actual value --> 'AEAAAEAA EE AA EE AA EE EEEAA AA AA '
After update --> 'AZAAAZAA EE AA EE AA EE EEEAA AA AA 'below is my requirement. I am adding the conditions dynamically as per the conditions. I dont know the position of the E. If 'E' is in any position I need to update with 'Z' if that 'E' satisfy the condition.
I dont want to update all the E's to Z's.
I want to update specific E's which satisfy the condition.
IF l_kwhhilow >= 1 THEN
l_where := l_where||' SUBSTR(OVERRIDEFIELD,1,1) = ''E'' OR ';
l_exp := l_exp||'Z';
ELSE
l_exp := l_exp||'\1';
END IF;
IF l_kwhilow >= 1 THEN
l_where := l_where||' SUBSTR(OVERRIDEFIELD,2,1) = ''E'' OR ';
l_exp := l_exp||'Z';
ELSE
l_exp := l_exp||'\2';
END IF;
IF l_kvahilow >= 1 THEN
l_where := l_where||' SUBSTR(OVERRIDEFIELD,3,1) = ''E'' OR ';
l_exp := l_exp||'Z';
ELSE
l_exp := l_exp||'\3';
END IF;
IF l_kvarhilow >= 1 THEN
l_where := l_where||' SUBSTR(OVERRIDEFIELD,4,1) = ''E'' OR ';
l_exp := l_exp||'Z';
ELSE
l_exp := l_exp||'\4';
END IF;
IF l_todkwh1hilow >= 1 THEN
l_where := l_where||' SUBSTR(OVERRIDEFIELD,5,1) = ''E'' OR ';
l_exp := l_exp||'Z';
ELSE
l_exp := l_exp||'\5';
END IF;
IF l_todkwh2hilow >= 1 THEN
l_where := l_where||' SUBSTR(OVERRIDEFIELD,6,1) = ''E'' OR ';
l_exp := l_exp||'Z';
ELSE
l_exp := l_exp||'\6';
END IF;
l_exp := ''''||l_exp||'''';
l_exp1 := '\1\2\3\4'||l_exp1;
IF l_todkw1hilow >= 1 THEN
l_where := l_where||' SUBSTR(OVERRIDEFIELD,11,1) = ''E'' OR ';
l_exp1 := l_exp1||'Z';
ELSE
l_exp1 := l_exp1||'\5';
END IF;
IF l_todkw2hilow = 1 THEN
l_where := l_where||' SUBSTR(OVERRIDEFIELD,12,1) = ''E'' OR ';
l_exp1 := l_exp1||'Z';
ELSE
l_exp1 := l_exp1||'\6';
END IF;
l_exp1 := ''''||l_exp1||'''';
IF i give 10 in the regexp_replace it is not working.
SET OVERRIDEFIELD = REGEXP_REPLACE(SUBSTR(overridefield,1,6), ''(.)(.)(.)(.)(.)(.)'','||l_exp||')'||
' ||REGEXP_REPLACE(SUBSTR(overridefield,7,6), ''(.)(.)(.)(.)(.)(.)'','||l_exp1||')'||
' ||SUBSTR(overridefield,13)'|| -
How to get resultset from oracle procedure use ejb3
how to get resultset from oracle procedure use ejb3
i know oracle procedure should like this
Create or replace PROCEDURE resultset_test(
aaa IN NUMBER,
bbb OUT sys_refcursor) ....
but what s the ejb3 scripts looks like? please give me an example or link~
ths- there are no EJB3 scripts, only compiled application code
- the part of the EJB spec that deals with databases is called the Java Persistence API, but likely you are just looking for the JDBC API.
Now you should know what to Google to get your "example script": "java jdbc oracle procedure" -
How to set Border in the Excel using UTL_FILE ?
Hi all,
Any one aware of
How to set Border in the Excel using UTL_FILE ?
Am doing excel creation from a stored procedure.
Thanks
DoraHello Dora,
if you need more than simple csv: at Re: How to save a query result and export it to, say excell? you can find links to different solutions. At least the package behind the second link supports defining your own formats (and has a tutorial how to do it).
Regards
Marcus -
Does anyone know how to display (in LabVIEW) the memory use during execution of an image and data acquisition VI to predict when it is time to cease the acquisition to prevent the program crashing?
I am acquiring images and data to a buffer on the edge of the while loop, and am finding that the crashing of the program is unpredictable, but almost always due to a memory saturation when the buffers gets too big.
I have attached the VI.
Thanks for the help
Attachments:
new_control_and_acquisition_program.vi 946 KBTake a look at this document that discusses how to monitor IMAQ memory usage:
http://digital.ni.com/public.nsf/websearch/8C6E405861C60DE786256DB400755957
Hope this helps -
Julie -
How can I connect to the database using ODBC within excel.
Hi,
How can I connect to the database using ODBC within excel and just refresh the data when needed.
Thanks,
Priyanka
Edited by: user554934 on Jun 9, 2009 2:53 AMThis is NOT an APEX relevant question, try posting it in the SQL/PL/SQL Forum..
Thank you,
Tony Miller
Webster, TX -
Does anyone know how to display (in LabVIEW) the memory use during execution of an image and data acquisition VI to predict when it is time to cease the acquisition to prevent the program crashing?
I am acquiring images and data to a buffer on the edge of the while loop, and am finding that the crashing of the program is unpredictable, but almost always due to a memory saturation when the buffers gets too big.
I have attached the VI.
Thanks for the help
Attachments:
new_control_and_acquisition_program.vi 946 KBgot these vi's off ni site a while ago - see if they help
Attachments:
Memory_Monitor.zip 132 KB -
How do you write on the documents useing using work space
how do you write on the documents using work space
What type of documents are you trying to write on?
-
How can I see all the idocs used in the system
I am very new in this area. How can I see all the idocs used in the system. Those which are posted and those which are not.
Check thes sap help links:
http://help.sap.com/saphelp_nw70/helpdata/en/90/c4b523c4c411d2a5ee0060087832f8/frameset.htm
http://help.sap.com/saphelp_nw70/helpdata/en/d5/edf15ddcdc11d1890c0000e8216438/content.htm
- Regards, Dibya -
How to improve performance of the attached query
Hi,
How to improve performance of the below query, Please help. also attached explain plan -
SELECT Camp.Id,
rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount,
(SUM(rCam.Impressions) * 0.001 + SUM(rCam.Clickthrus)) AS GR,
rCam.AccountKey as AccountKey
FROM Campaign Camp, rCamSit rCam, CamBilling, Site xSite
WHERE Camp.AccountKey = rCam.AccountKey
AND Camp.AvCampaignKey = rCam.AvCampaignKey
AND Camp.AccountKey = CamBilling.AccountKey
AND Camp.CampaignKey = CamBilling.CampaignKey
AND rCam.AccountKey = xSite.AccountKey
AND rCam.AvSiteKey = xSite.AvSiteKey
AND rCam.RmWhen BETWEEN to_date('01-01-2009', 'DD-MM-YYYY') and
to_date('01-01-2011', 'DD-MM-YYYY')
GROUP By rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount
Explain Plan :-
Description Object_owner Object_name Cost Cardinality Bytes
SELECT STATEMENT, GOAL = ALL_ROWS 14 1 13
SORT AGGREGATE 1 13
VIEW GEMINI_REPORTING 14 1 13
HASH GROUP BY 14 1 103
NESTED LOOPS 13 1 103
HASH JOIN 12 1 85
TABLE ACCESS BY INDEX ROWID GEMINI_REPORTING RCAMSIT 2 4 100
NESTED LOOPS 9 5 325
HASH JOIN 7 1 40
SORT UNIQUE 2 1 18
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY SITE 2 1 18
INDEX RANGE SCAN GEMINI_PRIMARY SITE_I0 1 1
TABLE ACCESS FULL GEMINI_PRIMARY SITE 3 27 594
INDEX RANGE SCAN GEMINI_REPORTING RCAMSIT_I 1 1 5
TABLE ACCESS FULL GEMINI_PRIMARY CAMPAIGN 3 127 2540
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY CAMBILLING 1 1 18
INDEX UNIQUE SCAN GEMINI_PRIMARY CAMBILLING_U1 0 1duplicate thread..
How to improve performance of attached query -
How to Run scenario from the web using HTTP web page?
Hi guys
Please let me know How to Run scenario from the web using HTTP web page?
Regards
JanakiramHi Janakiram,
ODI provides web based UI for running the scenarios using Metadata Navigator (read only of ur ODI components) and Lighweight designer (u can edit the mapping here).
Please explore how to install metadata navigator in ODI and have a look at ODI Setup document for more information.
Thanks,
Guru -
How to determine or verify the language used if your application is in mult
hi,
How to determine or verify the language used if your application is in multi Language Env.
Thanks & RegardsHi again;
I suggest also see below link which we discussed before here
Find languages installed in my R12 instance ?
Regard
Helios -
HT5654 how to add videos to the ipad using the latest version of itunes
how to add videos to the ipad using the latest version of itunes ?
Hello zaraa90,
After reviewing your post, I have located an article that can help with syncing content. It contains a number of troubleshooting steps and helpful advice for the issue you are experiencing:
Sync your iPhone, iPad and iPod with iTunes using USB
Thank you for contributing to Apple Support Communities.
Cheers,
BobbyD -
Determin how many user log on the site using JSP/Servlet?
Hi all,
Is there a way to determine how many user log on the site using JSP/Sevlet? I'm running Apache 2.x & Tomcat 4.x
I'm trying to get a list of user currently log in the site.
Please help!
Thanks,
-JN-You could use the HttpSessionBindingListener interface. Every time a user logs into the session put a user object into the session. The user object will implement the HttpSessionBindingListener interface. When the user object is added to a sessiion it recieves an event and it increments a counter. When the session times out or you invalidate the session because the user has logged out the user object will recieve an event and it can then decrement the counter.
This will at least tell how many active user sessions there are.
Maybe you are looking for
-
I just purchased Adobe 9 Pro. If I create a form in Adobe 9 Pro, will the person I am sending it to be able to fill it out if they only have Adobe Acrabat Reader?
-
Pass Parameter from main page to include page (subview) and read it ?
Hello All i have an include header.jsp page in main page.jsp ,and i included it by subview. i want to pass a parameter ex(screen name) to the subview by using f:param. Here is the code in main.jsp: <f:subview id="headerSubView"> <jsp:include page="/c
-
Best way to flatten out this table?
Lets say you're dealing with these two tables: CREATE TABLE VEHICLES VEHICLE_ID NUMBER, VEHICLE_NAME VARCHAR2(100 BYTE), MILES NUMBER CREATE TABLE VEHICLE_PARTS PART_ID NUMBER, VEHICLE_ID NUMBER NOT NULL, PART_TYPE NUMBER NOT NULL, PART_DESCRIPTION V
-
Audigy SE: advantages to using CD softwa
Any advantages to installing the software that came on the CD with an Audigy SE (I just installed the drivers)? Or is it bloatware? Thx.
-
Dear DBAs, I'm new to applications dba. I want to install Discoverer viewer/plus on my linux server 5.5. Can you please guide me from where can i get discoverer viewer or plus software. and how to install? In my server R12.1.1 is already installed. T