Pl/sql stored procedure code2 check the emial id is correct or not
if the mail id is [email protected]@.com
then how we do validations means
there must be only one @
i wnat all tghis type of validations 2 check the email id is correct or not?
the procedure that i wnat to validate akll the validations
This appears to be a duplicate of your existing thread
pl/sql stored procedure for email id validations
I'll answer there.
Justin
Similar Messages
-
Actuate 7 PL/SQL Stored Procedure Call Before the Report Run.
Hi,
I need a small help to call a pl sql stored procedure in actuate 7.
I wrote a code a on component content
Function runProc(procName as String, connection As AcDBConnection )
' Insert your code here
Dim statement As AcDBStatement
Dim results as string
' Prepare statement
Set statement = connection.Prepare("BEGIN " & procName & "; END;" )
If statement Is Nothing Then
results = "Failed to prepare statement."
results = results & " " & connection.GetSpecificErrorText( )
results = results & " " & connection.GetGeneralErrorText( )
Exit sub
End If
' Execute sprocoutparam
If statement.Execute() = 0 Then
results = "Stored procedure " & procName & "execution failed."
results = results & " " & connection.GetSpecificErrorText( )
results = results & " " & connection.GetGeneralErrorText( )
Else
results = "Stored procedure " & procName & " execution success."
End if
ShowFactoryStatus(results)
End FunctionNow this Code I am calling on the Chart Start Method
Sub Start( )
Super::Start( )
' Insert your code here
Dim ProcName as String
Dim connectionObject As AcDBConnection
ProcName="DELETECUSTOMER(1234)"
runProc(ProcName, connectionObject )
End SubNow when i Run the Report i get this Error !
NewReportApp::Frame::Chart%Start(9): Invalid procedure reference. - (runProc)
1 Semantic Error(s) found
Thanks,
Asifhi,
Finally Figured Out Here....
Steps to Call the Stored Procedure In Actuate 7
1 – Right Click on Content – Frame and go to properties and method Tab.
1 – Click on New Button to you create own custom method.
2 – Write the following code :
Sub runProc(procName as String, connection As AcDBConnection )
Dim statement As AcDBStatement
Dim results as string
Set connection = GetConnection()
'Prepare statement
Set statement = connection.Prepare("BEGIN " & procName & "; END;" )
If statement Is Nothing Then
results = "Failed to prepare statement."
results = results & " " & connection.GetSpecificErrorText( )
results = results & " " & connection.GetGeneralErrorText( )
MsgBox "Procedure Not Called....Badddddd"
Exit sub
End If
' Execute sprocoutparam
If statement.Execute() = 0 Then
results = "Stored procedure " & procName & "execution failed."
results = results & " " & connection.GetSpecificErrorText( )
results = results & " " & connection.GetGeneralErrorText( )
MsgBox "Procedure Not Called....Badddddd" & results
Else
results = "Stored procedure " & procName & " execution success."
MsgBox "Procedure Called....Wowwww"
End if
ShowFactoryStatus(results)
End Sub2 – Now let call the stored procedure before our actual report query runs.
1 - Right Click on Content – Frame and go to properties and method Tab.
2 - Select the Start Method and Click on Override button.
3 - Write the following code:
Sub Start( )
Dim ProcName as String
Dim connectionObject As AcDBConnection
Set connectionObject = GetConnection()
ProcName="XXTEST ()"
runProc( ProcName, connectionObject )
Super::Start ( )
End Sub3 – Now design your report as usual using the Textual Query window. -
Pl/sql stored procedure for email id validations
hi i need a stored procedure that validates the email id is coreect or not
***PL/SQL code for Email validation***-
DECLARE
t_valid NUMBER(1);
t_totallen NUMBER(2);
t_counter NUMBER(2):=0;
t_atpos NUMBER(2):= 1;
i NUMBER(2) := 1;
t_pointpos NUMBER(2):= 1;
mail_ch VARCHAR2(1);
result number; --:GR
BEGIN
t_totallen := LENGTH(:text_item_email);
t_counter := t_totallen;
i := 1;
t_valid := 1;
IF LENGTH(ltrim(rtrim(:text_item_email))) = 0 THEN
t_valid := 0;
ELSE
--This is to check special characters are present or not in the email ID
t_counter := t_totallen;
WHILE t_counter > 0
LOOP
mail_ch := substr(:text_item_email,i,1);
i := i+1;
t_counter := t_counter -1;
IF mail_ch IN (' ','!','#','$','%','^','&','*','(',')','-','','"',
'+','|','{','}','[',']',':','>','<','?','/','\','=') THEN
t_valid := 0;
EXIT;
END IF;
END LOOP;
--This is to check more than one '@' character present or not
t_atpos := instr(:text_item_email,'@',1,2) ;
IF t_atpos > 1 then
t_valid := 0;
END IF;
--This is to check at minimum and at maximum only one '@' character present
t_atpos := instr(:text_item_email,'@',1) ;
IF t_atpos IN (0,1) THEN
t_valid := 0;
END IF;
--This is to check at least one '.' character present or not
t_pointpos := instr(:text_item_email,'.',1) ;
IF t_pointpos IN (0,1) THEN
t_valid := 0;
END IF;
--This is to check at least one character is present between @ and '.' :GR
t_atpos := instr(:text_item_email,'@',1) ;
t_pointpos := instr(:text_item_email,'.',1) ;
IF t_pointpos-t_atpos<=1 THEN
t_valid := 0;
END IF;
--This is to check at least one character is present after '.' :GR
t_pointpos := instr(:text_item_email,'.',1) ;
IF t_totallen-t_pointpos<=0 THEN
t_valid := 0;
END IF;
END IF;
if(t_valid=0) then
message('Invalid Email');
result:=show_alert('alert_email');
raise form_trigger_failure;
end if;
END;
---***PL/SQL code for Name Validation***---
DECLARE
t_valid NUMBER(1);
t_totallen NUMBER(2);
t_counter NUMBER(2):=0;
i NUMBER(2) := 1;
name_ch VARCHAR2(1);
--name_ch_ascii NUMBER;
result number; --:GR
BEGIN
t_totallen := LENGTH(:text_item_first_name);
t_counter := t_totallen;
i := 1;
t_valid := 1;
IF LENGTH(ltrim(rtrim(:text_item_first_name))) = 0 THEN
t_valid := 0;
ELSE
--This is to check if each character in name lies in the valid ascii range
t_counter := t_totallen;
WHILE t_counter > 0
LOOP
name_ch := upper(substr(:text_item_first_name,i,1));
--name_ch_ascii := convert(name_ch,'US7ASCII');
i := i+1;
t_counter := t_counter -1;
--IF name_ch_ascii not between 65 and 90 THEN
IF name_ch not between 'A' and 'Z' THEN
t_valid := 0;
EXIT;
END IF;
END LOOP;
END IF;
if(t_valid=0) then
message('Invalid First Name');
result:=show_alert('alert_first_name');
raise form_trigger_failure;
end if;
END; -
Calling SQL stored procedure dynamically
Hallo,
could anybody tell me how to call HANA SQL stored procedure dynamically?
The coding looks like this:
v_ProcedureName := '"' || KpiNamespace || '::' || KpiName || '"';
v_SQL := 'CALL ' || :v_ProcedureName || '( lt_outKPI )';
EXEC :v_SQL;
For this call I get the error message:
"Transaction rolled back by an internal error: wrong number or types of parameters in call: Physical table is not allowed in OUT table variable position: LT_OUTKPI: line 1 col 55 (at pos 54)"
The procedure to be called dynamically has a table output parameter.
Thanks in advance,
Best Regards,
Alexey Romanov.
Hi Alex,
Can you share your requirement on exactly what is the need to call the procedure dynamically?
For your question, have a look on the below:
1) Have a procedure named EMPLOYEE_DETAILS
http://scn.sap.com/servlet/JiveServlet/downloadImage/2-14895702-415799/236-170/pastedImage_0.png
2) Created one more procedure named Dynamically as shown below:
CREATE PROCEDURE Dynamically ()
AS
BEGIN
DECLARE QUERY VARCHAR(1000);
QUERY := 'call EMPLOYEE_DETIALS(?)';
EXECUTE IMMEDIATE (:QUERY);
END;
3) Output:
http://scn.sap.com/servlet/JiveServlet/downloadImage/2-14895702-415800/210-189/pastedImage_3.png
Regards,
Krishna Tangudu
Hi Krishna,
Thanks for your reply!
Unfortunately, I can neither go to ‘full discussion’, nor open the pictures, you have attached, nor see you reply.
That’s why I just add my reply to the problem description.
The procedure name is composed out of 2 parts on-the-fly, that is why I have to call it dynamically:
create local temporary table "#KPIEvals"(
"KpiNamespace" NVARCHAR(256) CS_STRING,
"KpiName" NVARCHAR(32) CS_STRING,
"KpiText" NVARCHAR(256) CS_STRING,
"Responsible" NVARCHAR(256) CS_STRING );
FOR cur_row as c_cursor DO
v_SQL := '';
v_ProcedureName := '"' || cur_row."KpiNamespace" || '::' || cur_row."KpiName" || '"';
v_SQL := 'CALL ' || :v_ProcedureName || '( lt_outKPI )';
EXEC :v_SQL;
v_SQL := 'INSERT INTO "#KPIEvals" SELECT * FROM :lt_out_kpi';
EXEC :v_SQL;
END FOR;
I guess there might be 2 reasons for the problem:
1. All the procedures are called dynamically in a loop.
2. All the procedures have an output parameter, which is a table.
Hope that helps,
Best Regards,
Alex.Hi Alexey, I think what you may need to do in this case is to do the insert into your temp table from within the dynamically called procedure, therefore no need for output param in your procedure call. You can then select from the temp table in your main procedure. Hope that makes sense.
Peter -
Unable to use the values returned by a PL/SQL stored procedure in a XSQL page
Hi,
I've been messing around with XML and XSQL in particular. I was trying to write a xsql page to display a report with account totals...I have the following .xsql which calls a PL/SQL stored procedure :
<?xml version="1.0"?>
<xsql:query connection="pfcdm" xmlns:xsql="urn:oracle-xsql">
<xsql:set-session-param name="zasset_total" value="100">
<xsql:dml connection="pfcdm">
rraman.sp_vw_id(zasset_total,zinvm_total,zmkt_val);
</xsql:dml>
</xsql:set-session-param>
select 'Asset total is {@zasset_total}' as "ASSET_TOTAL" from dual
</xsql:query>
My procedure sp_vw_id returns the values that it should. But, I am not sure how to declare variables within a page, and to output the return values. There is very scanty documentation on the usage of <xsql:dml> or <xsql:ref-cursor-function>.
Any response would be greatly appreciated.
Thanks,
RajaHere is the example from the Oracle9i (complete rewrite) of the XSQL Chapter in our Oracle documentation.
Question
I using <xsql:dml> to call a stored procedure which has one OUT parameter, but I was not able to see any results. The executed code results in the following statement:
<xsql-status action="xsql:dml" rows="0"/>
Answer
You cannot set parameter values by binding them in the position of OUT variables in this release using <xsql:dml>. Only IN parameters are supported for binding. You can create a wrapper procedure that constructs XML elements using the HTP package and then your XSQL page can invoke the wrapper procedure using <xsql:include-owa> instead.
For an example, suppose you had the following procedure:
CREATE OR REPLACE PROCEDURE addmult(arg1 NUMBER,
arg2 NUMBER,
sumval OUT NUMBER,
prodval OUT NUMBER) IS
BEGIN
sumval := arg1 + arg2;
prodval := arg1 * arg2;
END;You could write the following procedure to "wrap" it, taking all of the IN arguments that the procedure above expects, and then "encoding" the OUT values as a little XML datagram that you print to the OWA page buffer:
CREATE OR REPLACE PROCEDURE addmultwrapper(arg1 NUMBER, arg2 NUMBER) IS
sumval NUMBER;
prodval NUMBER;
xml VARCHAR2(2000);
BEGIN
-- Call the procedure with OUT values
addmult(arg1,arg2,sumval,prodval);
-- Then produce XML that encodes the OUT values
xml := '<addmult>'| |
'<sum>'| |sumval| |'</sum>'| |
'<product>'| |prodval| |'</product>'| |
'</addmult>';
-- Print the XML result to the OWA page buffer for return
HTP.P(xml);
END;This way, you can build an XSQL page like this that calls the wrapper procedure:
<page connection="demo" xmlns:xsql="urn:oracle-xsql">
<xsql:include-owa bind-params="arg1 arg2">
BEGIN addmultwrapper(?,?); END;
</xsql:include-owa>
</page>This allows a request like:
http://yourserver.com/addmult.xsql?arg1=30&arg2=45
to return an XML datagram that reflects the OUT values like this:
<page> <addmult><sum>75</sum><product>1350</product></addmult>
</page> -
To find the location of PL/SQL stored PROCEDURE in database
hi
this is the detail i ve taken from Application developer-Concurrent Program Executable
Executable NAPESCO_STAFF_LEDGER_DTLS
Short Name NPSTALEDDTLS
Application Human Resources
Execution Method PL/SQL Stored Procedure
Execution File name NAPESCO_STAFF_LEDGER_DTLS
i would like to know how to view and modify this procedure ,where is it stored
kindly helpHi,
This seems to be a custom package. To view the source of the "PL/SQL Stored Procedure" concurrent program please refer to (Note: 455582.1 - Where Can I Get the Source File of Any 'Pl/Sql Stored Procedure' on Current Program?).
Thanks,
Hussein -
Why doesn't SSRS like an IF Statement in my SQL Stored Procedure???
I have multiple IF Statements at the end of my SQL Stored Procedure Process that utilizes a @ReportTypeName Parameter to produce the chosen report result set
IF @ReportTypeName = 'HMO-POS New To HFHP - No Prior Year Member Spans'
BEGIN
SELECT DISTINCT
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Member Contract Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Member Subscriber Member Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Pkg],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Division Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER EFF DATE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER FIRST NAME],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER LAST NAME],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Broker Name],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER ADDRESS 1],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER CITY],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER STATE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER ZIPCODE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE1],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE2],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE3],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER EMAIL],
CONVERT(VARCHAR,CAST(CONVERT(VARCHAR, [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER YMDBIRTH]) AS DATETIME),101) AS [INDV MEMBER BirthDate],
FLOOR((CAST (GETDATE() AS INTEGER) - CAST(CONVERT(DATETIME, CONVERT(CHAR(8), [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER YMDBIRTH])) AS INTEGER)) / 365.25) AS [INDV MEMBER AGE]
FROM [#TempTable_Distinct_Individual_Member_All_Info]
WHERE (CHARINDEX('HMO',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0
OR CHARINDEX('POS',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0)
AND [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR] NOT IN
(SELECT [#TempTable_Distinct_Individual_Member_Prior_Year_Spans].[INDV MEMBER NBR]
FROM [#TempTable_Distinct_Individual_Member_Prior_Year_Spans])
ORDER BY [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR]
END
IF @ReportTypeName = 'HMO-POS Renewals'
BEGIN
SELECT DISTINCT
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Member Contract Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Member Subscriber Member Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Pkg],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Division Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER EFF DATE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER FIRST NAME],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER LAST NAME],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Broker Name],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER ADDRESS 1],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER CITY],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER STATE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER ZIPCODE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE1],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE2],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE3],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER EMAIL],
CONVERT(VARCHAR,CAST(CONVERT(VARCHAR, [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER YMDBIRTH]) AS DATETIME),101) AS [INDV MEMBER BirthDate],
FLOOR((CAST (GETDATE() AS INTEGER) - CAST(CONVERT(DATETIME, CONVERT(CHAR(8), [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER YMDBIRTH])) AS INTEGER)) / 365.25) AS [INDV MEMBER AGE]
FROM [#TempTable_Distinct_Individual_Member_All_Info]
INNER JOIN [#TempTable_Distinct_Individual_Member_Prior_Year_Spans]
ON [#TempTable_Distinct_Individual_Member_Prior_Year_Spans].[INDV MEMBER NBR] = [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR]
WHERE (CHARINDEX('HMO',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0
OR CHARINDEX('POS',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0)
ORDER BY [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR]
END
Microsoft Visual Studio and SQL Server Reporting Services did not like this! When I added my dataset and parameters accordingly, my Dataset had no fields...almost as if running the Stored Procedure in the background to get its Metadata was not working. I
know this works because I tested it as a result of a straight EXEC Command. Why doesn't Microsoft Visual Studio and SQL Server Reporting Services not like this IF? I did end up getting around this by parameterizing the WHERE clause based on the @ReportTypeName
chosen.
WHERE (@ReportTypeName = 'HMO-POS New To HFHP - No Prior Year Member Spans'
AND (CHARINDEX('HMO',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0
OR CHARINDEX('POS',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0)
AND [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR] NOT IN
(SELECT [#TempTable_Distinct_Individual_Member_Prior_Year_Spans].[INDV MEMBER NBR]
FROM [#TempTable_Distinct_Individual_Member_Prior_Year_Spans]))
OR (@ReportTypeName = 'HMO-POS Renewals'
AND (CHARINDEX('HMO',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0
OR CHARINDEX('POS',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0)
AND [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR] IN
(SELECT [#TempTable_Distinct_Individual_Member_Prior_Year_Spans].[INDV MEMBER NBR]
FROM [#TempTable_Distinct_Individual_Member_Prior_Year_Spans]))
I appreciate your review and am hopeful for a reply.
Thanks!Hi ITBobbyP,
I have tested on my local environment and can reproduce the issue, the issue can be caused by the temp table you are using which will also cause the data not display.
I have use below sample table and record to have a test and details information below for your reference:
Right click the DataSet to select the "DataSet Properties" and click the query designer to execute the stored procedure by click the "!" to check if you can get the data:
If you got some error, the issue can be cause by the temp table invalid, so please make sure you have add the query to create and insert recored to temp table like below:
CREATE PROCEDURE vickytest0311_1
@ReportTypeName nvarchar(50)
AS
create table #VickyTest
column1 int,
column2 varchar(20)
insert into #VickyTest values (1,'Test1')
insert into #VickyTest values (2,'Test2')
insert into #VickyTest values (3,'Test3')
IF @ReportTypeName ='Test1'
BEGIN
select * from #VickyTest
where Column1=1
END
IF @ReportTypeName ='Test2'
BEGIN
select * from #VickyTest
where Column1=2
END
GO
3. I recommend you to not use the temp table and you will not need to add the create and insert statement in the stored procedure.
4. If you still got no data, please try to click the "Refresh fields" as below:
If you still have any problem, please feel free to ask.
Regards,
Vicky Liu
Vicky Liu
TechNet Community Support -
PL/SQL stored procedure?
Hi,
Is any body could help me to execute
an PL/SQL stored procedure via JDev3.1
(using Oracle conection, No JDBC).
Please provide sample code if possible?
Thanks in Advance.
RezaHi
you could use JPublisher Wizard in JDeveloper to generate Java Wrapper classes for pl/sql stored procedures.
check out the online demos http://technet.oracle.com/products/jdev/info/jdev/jpublisher/s000.html
Also there is information in the online doc.
Check the release notes for supported database versions.
raghu -
Very Odd PL/SQL Stored Procedure Behavior
I'm writing a jsp/struts front-end for a legacy app that makes extensive use of stored procedures. I've sucessfully created a login page, a search page, and a master record detail/edit page. On the master record detail there are a series of subordinate data grids, each with links to individual pages for record editing.
If I edit the master record and click my save button (a commit action), the appropriate stored proc is called and everything works as it should.
BUT, if I click on the edit link to a subordinate table, I am taken to the screen, I can make changes, and when I click save (another commmit event) the stored procedure for that table is not called. No errors, the struts action takes me back to the previous screen (correctly), but nothing is saved.
The weird part is, once I've returned to the master record page, if I edit the master record and click the same save button as before, the stored procedure for the subordinate table that I had just looked at is fired.
I know my struts actions are correct, since the pages navigate correctly (at least, I 'think' I know that). I used the same code in the EO Impl to set up my call to the stored procs.
Does anybody have ANY idea what might be causing this? I'm lost and confused at this point.
(EO Impl Code below)
/*doesn't print dodml until I click save on the master record...this is the code for the child. */
protected void doDML(int operation, TransactionEvent e)
System.out.println("dodml");
switch (operation) {
case DML_INSERT: {
callInsertExternalNumber("I");
break;
case DML_UPDATE: {
callInsertExternalNumber("U");
break;
void callInsertExternalNumber(String function) {
CallableStatement st = null;
try {
System.out.println("calling stored proc");
String stmt = "BEGIN mySchema.InsertNumber(?,?,?,?,?,?,?); END;";
DBTransaction tr = getDBTransaction();
st = tr.createCallableStatement(stmt,1);
if (getExternalKey() != null) {
st.setLong(1,getExternalKey().longValue());
...etc. etc. The calling stored proc doesn't get printed until I click save on the master record.Hi
you could use JPublisher Wizard in JDeveloper to generate Java Wrapper classes for pl/sql stored procedures.
check out the online demos http://technet.oracle.com/products/jdev/info/jdev/jpublisher/s000.html
Also there is information in the online doc.
Check the release notes for supported database versions.
raghu -
Do I run a shell script (bsh) via PL/SQL stored procedure?
Hello guys,
Do I run a shell script (bsh) via PL/SQL stored procedure?
For example:
procedure X is
(variables)
begin
-- Read file data
vFileHandle := utl_file.fopen('/mnt/novell/', 'file.txt','r');
exception
when 'INVALID READ FILE' then
(I've to try running script to mount a Novell partition.);
end;
I've to installed Oracle 9.0.1 on Suse Linux.
Please, any ideas or hints ...
Thx and regards.You might be able to us the HOST command, I think you'd have to run it via dbms_sql, check this page for more details, not sure if it'll be of help but its worth a try..
http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a82950/ch8.htm
Cheers
Rob -
Hello
I'm hoping that someone here might be able to help or point me in the right direction. Apologies for the long post.
Just to set the scene, I am a SQL Server DBA and have very limited experience with System Centre so please go easy on me.
At the company I am currently working they are complaining about very poor performance when running reports (any).
Quick look at the database server and CPU utilisation being a constant 90-95%, meant that you dont have to be Sherlock Holmes to realise there is a problem. The instance consuming the majority of the CPU is the instance hosting the datawarehouse and in particular
a stored procedure in the DWStagingAndConfig database called Staging.GroomDwStagingData.
This stored procedure executes continually for 2 hours performing 500,000,000 reads per execution before "timing out". It is then executed again for another 2 hours etc etc.
After a bit of diagnosis it seems that the issue is either a bug or that there is something wrong with our data in that a stored procedure is stuck in an infinite loop
System Center 2012 SP1 CU2 (5.0.7804.1300)
Diagnosis details
SQL connection details
program name = SC DAL--GroomingWriteModule
set quoted_identifier on
set arithabort off
set numeric_roundabort off
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on
set cursor_close_on_commit off
set implicit_transactions off
set language us_english
set dateformat mdy
set datefirst 7
set transaction isolation level read committed
Store procedures executed
1. dbo.p_GetDwStagingGroomingConfig (executes immediately)
2. Staging.GroomDwStagingData (this is the procedure that executes in 2 hours before being cancelled)
The 1st stored procedure seems to return a table with the "xml" / required parameters to execute Staging.GroomDwStagingData
Sample xml below (cut right down)
<Config>
<Target>
<ModuleName>TransformActivityDim</ModuleName>
<WarehouseEntityName>ActivityDim</WarehouseEntityName>
<RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName>
<Watermark>2015-01-30T08:59:14.397</Watermark>
</Target>
<Target>
<ModuleName>TransformActivityDim</ModuleName>
<WarehouseEntityName>ActivityDim</WarehouseEntityName>
<RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName>
<ManagedTypeViewName>MTV_Microsoft$SystemCenter$Orchestrator$RunbookAutomationActivity</ManagedTypeViewName>
<Watermark>2015-01-30T08:59:14.397</Watermark>
</Target>
</Config>
If you look carefully you will see that the 1st <target> is missing the ManagedTypeViewName, which when "shredded" by the Staging.GroomDwStagingData returns the following result set
Example
DECLARE @Config xml
DECLARE @GroomingCriteria NVARCHAR(MAX)
SET @GroomingCriteria = '<Config><Target><ModuleName>TransformActivityDim</ModuleName><WarehouseEntityName>ActivityDim</WarehouseEntityName><RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName><Watermark>2015-01-30T08:59:14.397</Watermark></Target><Target><ModuleName>TransformActivityDim</ModuleName><WarehouseEntityName>ActivityDim</WarehouseEntityName><RequiredWarehouseEntityName>MTV_System$WorkItem$Activity</RequiredWarehouseEntityName><ManagedTypeViewName>MTV_Microsoft$SystemCenter$Orchestrator$RunbookAutomationActivity</ManagedTypeViewName><Watermark>2015-01-30T08:59:14.397</Watermark></Target></Config>'
SET @Config = CONVERT(xml, @GroomingCriteria)
SELECT
ModuleName = p.value(N'child::ModuleName[1]', N'nvarchar(255)')
,WarehouseEntityName = p.value(N'child::WarehouseEntityName[1]', N'nvarchar(255)')
,RequiredWarehouseEntityName =p.value(N'child::RequiredWarehouseEntityName[1]', N'nvarchar(255)')
,ManagedTypeViewName = p.value(N'child::ManagedTypeViewName[1]', N'nvarchar(255)')
,Watermark = p.value(N'child::Watermark[1]', N'datetime')
FROM @Config.nodes(N'/Config/*') Elem(p)
/* RESULTS - NOTE THE NULL VALUE FOR ManagedTypeViewName
ModuleName WarehouseEntityName RequiredWarehouseEntityName ManagedTypeViewName Watermark
TransformActivityDim ActivityDim MTV_System$WorkItem$Activity NULL 2015-01-30 08:59:14.397
TransformActivityDim ActivityDim MTV_System$WorkItem$Activity MTV_Microsoft$SystemCenter$Orchestrator$RunbookAutomationActivity 2015-01-30 08:59:14.397
When the procedure enters the loop to build its dynamic SQL to delete relevant rows from the inbound schema tables it concatenates various options / variables into an executable string. However when adding a NULL value to a string the entire string becomes
NULL which then gets executed.
Whilst executing "EXEC(NULL)" would cause SQL to throw an error and be caught, executing the following doesnt
DECLARE @null_string VARCHAR(100)
SET @null_string = 'hello world ' + NULL
EXEC(@null_string)
SELECT @null_string
So as it hasnt caused an error the next part of the procedure is to move to the next record and this is why its caught in an infinite loop
DELETE @items WHERE ManagedTypeViewName = @View
The value for the variable @View is the ManagedTypeViewName which is NULL, as ANSI_NULLS are set to ON in the connection and not overridded in the procedure then the above statement wont delete anything as it needs to handle NULL values differently (IS NULL),
so we are now stuck in an infinite loop executing NULL for 2 hours until cancelled.
I amended the stored procedure and added the following line before the loop statement which had the desired effect and "fixed" the performance issue for the time being
DELETE @items WHERE ManagedTypeViewName IS NULL
I also noticed that the following line in dbo.p_GetDwStagingGroomingConfig is commented out (no idea why as no notes in the procedure)
--AND COALESCE(i.ManagedTypeViewName, j.RelationshipTypeViewName) IS NOT NULL
There are obviously other ways to mitigate the dynamic SQL string being NULL, there's more than one way to skin a cat and thats not why I am asking this question, but what I am concerned about is that is there a reason that the xml / @GroomingCriteria is incomplete
and / or that the procedures dont handle potential NULL values.
I cant find any documentation, KBs, forum posts of anyone else having this issue which somewhat surprises me.
Would be grateful of any help / advice that anyone can provide or if someone can look at their 2 stored procedures on a later version to see if it has already been fixed. Or is it simply that we have orphaned data, this is the bit that concerns most as I dont
really want to be deleting / updating data when I have no idea what the knock on effect might be
Many many thanks
AndyFirst thing I would do is upgrade to 2012 R2 UR5. If you are running non-US dates you need the UR5 hotfix also.
Rob Ford scsmnz.net
Cireson www.cireson.com
For a free SCSM 2012 Notify Analyst app click
here -
PL/SQL Stored procedures vs C# code.
Hi All
We are going to start designing a kind of transactional application with huge volume of data (150 million records per month). Our selected DB engine is Oracle 10.g while C# is selected development language.
Because of big volume of data performance is one of the most important factors for us, and the technical design should gain the best level of performance.
What i'm looking for and studing for it is to define which kind of operation shall be done by Stored Procedure which will be written by PL/SQL or by C# classes?
I don't interested in to handle complicated and complex jobs using PL/SQL stored procedures while the performance really deserve it.Hello,
Well, my philosophy is to leverage the database as much as possible. I have worked with applications that had no "select", "insert", "update" or "delete" statements in them. Instead, stored procedures and functions inside of PL/SQL packages and bodies were used. Some people will argue strongly against that, but I belong to the "thick database" group rather than the "the database is just a persistence layer that I have to deal with" group. To me it makes sense to co-locate the code that works on the data with the data. If you are working with large volumes of data, I find the bulk operations available via PL/SQL to be very handy.
Here's an AskTom thread that deals with this general issue:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:12083187196917
Whilst the thread is primarily about Java, you can substitute just about any other language and the meaning will still carry over.
Regards,
Mark -
Added new parm to an existing SQL stored procedure CR 11 doesn't like it
Hi
I have added a new parameter to an existing SQL stored procedure (SQL 2000). This stored procedure is currently being called from a Crystal XI report. It prompts for a date which works great. (The report was created with this parameter). I added a new parameter to the stored procedure. When I do a preview in Crystal, it prompts for the new parameter, but is NULL when I look at the SQL query and it brings back no data. If I try to verify the database, it tells me that I am missing parameter @ProcessType (varchar(5))--(name of new parameter). I have physically added this parameter to the crystal report with the select expert and still no luck. I have already tried renaming the procedure but am unable to update datasource location because of this parameter. The report is very detailed and I do NOT want to create a new report.Unfortunately, I have tried and retried to do this. Nothing changes. I usually would get a message like database has changed, proceeding to fix report. I don't get this. It merely tells me database is up to date and only returns the 1 parameter, yet when I go to the datasouce and try to update it, it tells me that I have not supplied the new parameter.
I have tried everything, from closing Crystal reports and then going so far as to reboot my machine, just in case their was some kind of caching going on.
I have even asked other people I work with to look at it to make sure I am not doing something dumb... -
How to bind arrays to PL/SQL stored procedure using OCI?
Hi,
We are having problems trying to bind arrays to PL/SQL stored procedure using OCI. Here is the situation:
- We have a stored procedure called "GetVEPFindTasks" with the following interface:
PROCEDURE GetVEPFindTasks (
p_ErrorCode OUT NUMBER,
p_ErrorMsg OUT VARCHAR2,
p_RowCount OUT NUMBER,
p_VEPFindTasks OUT t_VEPFindTaskRecordTable,
p_MaxTask IN NUMBER);
t_VEPFindTaskRecordTable is a record with the following entries:
TYPE t_VEPFindTaskRecord IS RECORD (
RTCID NUMBER,
TransNum NUMBER,
TransTimestamp VARCHAR2(20),
Pathname1 image_data.pathname%TYPE,
Pathname2 image_data.pathname%TYPE,
Pathname3 image_data.pathname%TYPE,
OperatorID operator.id%TYPE);
- Now, we are trying to call the stored procedure from C++ using OCI (in UNIX). The call that we use are: OCIBindByName and OCIBindArrayOfStruct to bind the parameters to the corresponding buffers. We bind all parameters in the interface by name. Now, we do bind the record's individual item by name (RTCID, TransNum, etc.), and not as a record. I don't know if this is going to work. Then, we use the bind handles of the binded record items (only record items such as RTCID, TransNum, and NOT error_code which is not part of the record) to bind the arrays (using OCIBindArrayOfStruct).
All of the parameters that are binded as arrays are OUTPUT parameters. The rest are either INPUT or INPUT/OUTPUT parameters. Now, when we try to execute, OCI returns with an error "Invalid number or types of arguments" (or something to that sort... the number was something like ORA-06550). Please help...
Is there any sample on how to use the OCIBindArrayOfStruct with PL/SQL stored procedures? The sample provided from Oracle is only for a straight SQL statement.
Thank's for all your help.
** Dannil Chan **As you said:
You have to pass in an array for every field and deconstruct/construct the record in the procedure. There is no support for record type or an array of records. Can you give me a example? I'am very urgently need it.
thanks
email: [email protected] -
Creating XML report using PL/SQL Stored Procedure
Hi Friends,
I am working on an xml report with the xml source as PL/SQL Stored Procedure.
I am referring the exercise shown in the following link to understand the process:
http://orclapp.blogspot.com/2012/02/developing-xml-publisher-report-using.html
In the example shown in the above link I could not understand the following:
1) In the following procedure, the out parameter 'retcode' is not used at all.
What is the importance of this parameter.
PROCEDURE REPORT (errbuf OUT VARCHAR2, retcode OUT VARCHAR2, p_product_id IN NUMBER)
2) After the xml data is prepared and put to 'l_result' Clob variable, the following
Loop is executed. I am not able to appreciate why the following loop is required.
LOOP
EXIT WHEN l_length = l_retrieved;
IF (l_length - l_retrieved) < 32000
THEN
SELECT SUBSTR (l_result, l_retrieved + 1) INTO l_xmlstr FROM DUAL;
l_retrieved := l_length;
fnd_file.put_line (fnd_file.output, l_xmlstr);
ELSE
SELECT SUBSTR (l_result, l_retrieved + 1, l_offset)
INTO l_xmlstr
FROM DUAL;
l_retrieved := l_retrieved + l_offset;
fnd_file.put_line (fnd_file.output, l_xmlstr);
END IF;
END LOOP;
3) In the example it is not explained how the concurrent program gets the xml data?
I assume it is written to a file using the following line of code:
fnd_file.put_line (fnd_file.output, l_xmlstr);
I would appreciate if anyone can throw some light into my above queries so that I can understand the process clearly.
Thanks & Regards
HawkerHi 32000 in the code is a 'safe' size smaller than the max available 32767, the loops purpose is to move through the entire thing in chunks that will be manageable in the limits of the data type.
Btw; if you are in Oracle e-business suite then you can also use Oracle reports very simply to create XML output.
If you have reports developer all you need to do is put raw sql (without any 'artifice' to create XML) in the report SQL and then set the reports output to XML in the program definition in Oracle e-business.
best regards,
Robert.
Maybe you are looking for
-
My apple mail has an error message and won't open after iTunes update 6/20/14
I have a MacBook 13 Aluminum using Mountain Lion/MavericksX. Soon after I did a random update for iTunes mid June 2014 I noticed that I could no longer open my mail on my desktop. I did tell Apple about it when the error message came up, but I haven'
-
Hi how i know my iphone production
Hi how i know my iphone production
-
Microsoft Remote Desktop Preview for WP 8.1 - only for English OS?
Hi I tried to install the Remote Desktop Preview for Windows Phone 8.1 on my Lumia 930 but got error 80073cf0. Can the preview only be installed on en-US localized devices? Regards Markus
-
Tax Value not flowing to NET Value
Dear Guru's I am facing a problem in TAXINN, Tax amount is visible and updating at item level but at header level value is not getting added up. For example Base price = 100 BEDECessShecess = 14.42 LST Or Vat = 14.40 on 114.42 net value in item
-
Controlling Area and Responsible cost center
Hi, is it possible to find out "Controlling Area" and "Responsible cost center"to SAP USER Friendly regards Alexander