How do I submit to stored procedure with dynamic number of controls on page
I need to submit to a stored procedure from a dynamic page that has a variable number of controls. In the past I have always had a procedure that took 1 input parameter for each control. Now I will not know how many controls are on the form.
Is it possible to submit some type of parameter array?
Thanks,
Hi,
To declare a bind variable in SQL*Plus, use the SQL*Plus VARIABLE command with a data type:
SQL> VARIABLE n NUMBEROr you could change your code so that it uses the local variable n instead of the bind variable by removing the ":"
DECLARE
v_new_jobno BINARY_INTEGER;
n number;
BEGIN
DBMS_JOB.SUBMIT (n
,job => v_new_jobno
,what => 'spMyTest(null,null,n);'
,next_date => sysdate
,interval => 'sysdate + 1');
commit;
END;
/
Similar Messages
-
How to call PL/SQL stored procedure with TWO or more arguments from URL?
Hi all,
does anybody know, how to call stored procedure with more than one argument?
How to do this with one argument is known -
<img src="#OWNER#.retreive_img_data?i_id=#IMG_ID#" width="70" height="80" alt="No Picture">
But if I need to call procedure with two formal parameters? And need to pass through URL, for example, two page item values?Just separate with an "&". Using your previous example, I'll add i_name and i_type:
<img src="#OWNER#.retreive_img_data?i_id=#IMG_ID#&i_name=somename&i_type=jpg" width="70" height="80" alt="No Picture" />
Tyler -
Pointbase : How can I create a stored procedure with Pointbase database?
Hello,
Excuse me for my english, I'm not anglophone. I try to create a stored procedure.
This is my file SampleExternalMethods.java :
import java.sql.*; //import com.pointbase.jdbc.jdbcInOutDoubleWrapper; public class SampleExternalMethods { // A connection object to allow database callback static Connection conn = null; static Statement l_stmt; static Statement m_stmt; static CallableStatement m_callStmt = null; static ResultSet l_rs = null; public static void main(String[] args) { try { String url = "jdbc:pointbase:server://localhost/pointbaseDB"; String username = "PBPUBLIC"; String password = "PBPUBLIC"; conn = DriverManager.getConnection(url, username, password); doCreateProcedure(); doInvokeProcedure(); } catch (SQLException e) { e.printStackTrace(); } finally { if (m_stmt != null) { try { m_stmt.close(); } catch (Exception e) { e.printStackTrace(); } } if (m_callStmt != null) { try { m_callStmt.close(); } catch (Exception e) { e.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (Exception e) { e.printStackTrace(); } } } } public static void getCountry(String Iso_Code) { try { // Query the database for the country iso code l_stmt = conn.createStatement(); l_rs = l_stmt.executeQuery( "SELECT * FROM countries" + " WHERE country_iso_code ='" + Iso_Code + "'"); //Affichage du résultat de la requête l_rs.next(); System.out.print(l_rs.getString(1) + " - "); System.out.print(l_rs.getString(2) + " - "); System.out.println(l_rs.getString(3)); // Close the result set l_rs.close(); } catch (SQLException e) { e.printStackTrace(); } finally { if (l_rs != null) { try { l_rs.close(); } catch (Exception e) { e.printStackTrace(); } } if (l_stmt != null) { try { l_stmt.close(); } catch (Exception e) { e.printStackTrace(); } } } } public static void doCreateProcedure() throws SQLException { // SQL statement to create a stored procedure String SQL_CREATE_PROC = "CREATE PROCEDURE getCountry(IN P1 VARCHAR(30))" + " LANGUAGE JAVA" + " SPECIFIC getCountry" + " NO SQL" + " EXTERNAL NAME \"SampleExternalMethods::getCountry\"" + " PARAMETER STYLE SQL"; // Create a SQL statement m_stmt = conn.createStatement(); // Execute the SQL m_stmt.executeUpdate(SQL_CREATE_PROC); // Close the statement //m_stmt.close(); } public static void doInvokeProcedure() throws SQLException { // Create SQL to invoke stored procedures String SQL_USE_PROC = "{ call getCountry(?) }"; // Create a callable statement with three binding parameters m_callStmt = conn.prepareCall(SQL_USE_PROC); m_callStmt.setString(1, "CA"); m_callStmt.executeQuery(); // Close the callable statement //m_callStmt.close(); } }
Afterwards, I have read this note in a Pointbase document:
To invoke the dateConvert external Java method from a stored function, you must use the
CREATE FUNCTION statement. The dateConvert external Java method is called from the
class, SampleExternalMethods.
In order for the database to access this external Java method, the class SampleExternalMethods
must be included in the database CLASSPATH. For PointBase Embedded - Server Option, it
must be in the Server CLASSPATH, but not in the Client CLASSPATH.
If PointBase Server is run with the Java Security Manager, in the java policy file grant
’com.pointbase.sp.spPermission’ to the class that implements the external Java method.
An "spPermission" consists of a class name with no action. The class name is a name of a class
that could be used in creating a Stored Procedure in PointBase. The naming convention follows
the hierarchical property naming convention and that is supported by
"java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded
by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
contain any white spaces.
I'm not sure, but I suppose that I must include the class SampleExternalMethods in a .jar file.
The database CLASSPATH could be : C:\Sun\AppServer\pointbase\lib\
These my files in this database CLASSPATH:
pbclient.jar
pbembedded.jar
pbtools.jar
pbupgrade.jar
I have tryed to include the class SampleExternalMethods in pbclient.jar and pbembedded.jar with this command:
jar -uf pbembedded.jar SampleExternalMethods
Afterwards I do that,
1) Start Pointbase
2) Configuration of classpath
set classpath=C:\Sun\AppServer\pointbase\lib\pbclient.jar
set classpath=%classpath%;D:\J2EE\Ch07Code\Ch07_06
I precise that my file SampleExternalMethods is into D:\J2EE\Ch07Code\Ch07_06\Ch07.
Then, I run the program:
D:\J2EE\Ch07Code\Ch07_06>java -Djdbc.drivers=com.pointbase.jdbc.jdbcUniversalDriver Ch07.SampleExternalMethods
But I have an error message:
Exception in thread "main" java.lang.NoClassDefFoundError: Ch07.SampleExternalMethods (wrong name: SampleExternalMethods)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.DefineClass(ClassLoader.java:539)
The problem, I suppose, comes from that the class SampleExternalMethods
must be included in the database CLASSPATH, but there is a pbserver.jar with pointbase normally, but I didn't find it. That's why I use pbembedded.jar or pbclient.jar in order to include the class SampleExternalMethods. May be I must start from C:\Sun\AppServer\pointbase\lib\ instead of D:\J2EE\Ch07Code\Ch07_06\Ch07?
Please, can somebody helps me?
Thank you in advance.
cagou!jschell wrote:
And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
>And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
>
And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
Thank you for your response, I have done two classes:
SampleExternalMethods.java:
package Ch07;
import java.sql.*;*
*public class SampleExternalMethods*
*public static void getCountry(String Iso_Code)*
*// A connection object to allow database callback*
*Connection l_conn = null;*
*Statement l_stmt = null;*
*ResultSet l_rs = null;*
*try*
*String url = "jdbc:pointbase:server://localhost/pointbaseDB";*
*String username = "PBPUBLIC";*
*String password = "PBPUBLIC";*
*l_conn = DriverManager.getConnection(url, username, password);*
*// Query the database for the country iso code*
*l_stmt = l_conn.createStatement();*
*l_rs = l_stmt.executeQuery( "SELECT* FROM PBPUBLIC.COUNTRIES"
+" WHERE country_iso_code ='"+ Iso_Code +"'");+
+//Affichage du résultat de la requête+
+l_rs.next();+
+System.out.print(l_rs.getString(1)+ " - ");
System.out.print(l_rs.getString(2) +" - ");+
+System.out.println(l_rs.getString(3));+
+// Close the result set+
+l_rs.close();+
+} catch (SQLException e) {+
+e.printStackTrace();+
+} finally {+
+if (l_rs != null) {+
+try {+
+l_rs.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+if (l_stmt != null) {+
+try {+
+l_stmt.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+if (l_conn != null) {+
+try {+
+l_conn.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+}+
+}+
+}+
CreateMethods.java:
+package Ch07;+
+import java.sql.*;+
+public class CreateMethods+
+{+
+// A connection object to allow database callback+
+static Connection m_conn = null;+
+static Statement m_stmt;+
+static CallableStatement m_callStmt = null;+
+public static void main(String[] args)+
+{+
+try+
+{+
+String url = "jdbc:pointbase:server://localhost/pointbaseDB";+
+String username = "PBPUBLIC";+
+String password = "PBPUBLIC";+
+m_conn = DriverManager.getConnection(url, username, password);+
+doCreateProcedure();+
+doInvokeProcedure();+
+} catch (SQLException e) {+
+e.printStackTrace();+
+} finally {+
+if (m_stmt != null) {+
+try {+
+m_stmt.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+if (m_callStmt != null) {+
+try {+
+m_callStmt.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+if (m_conn != null) {+
+try {+
+m_conn.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+}+
+}+
+public static void doCreateProcedure() throws SQLException {+
+// SQL statement to create a stored procedure+
+String SQL_CREATE_PROC = "CREATE PROCEDURE PBPUBLIC.getCountry(IN P1 VARCHAR(30))"+
" LANGUAGE JAVA"
+" SPECIFIC getCountry"+
" NO SQL"
+" EXTERNAL NAME \"SampleExternalMethods::getCountry\""+
" PARAMETER STYLE SQL";
// Create a SQL statement
m_stmt = m_conn.createStatement();
// Execute the SQL
m_stmt.executeUpdate(SQL_CREATE_PROC);
// Close the statement
//m_stmt.close();
public static void doInvokeProcedure() throws SQLException {
// Create SQL to invoke stored procedures
String SQL_USE_PROC = "{ call getCountry(?) }";
// Create a callable statement with three binding parameters
m_callStmt = m_conn.prepareCall(SQL_USE_PROC);
m_callStmt.setString(2, "CA");
m_callStmt.executeQuery();
// Close the callable statement
//m_callStmt.close();
}But I have the same error message that previously.
I have read this note and I suppose that the problem is linked:
If PointBase Server is run with the Java Security Manager, in the java policy file grant
*com.pointbase.sp.spPermission to the class that implements the external Java method.*
An "spPermission" consists of a class name with no action. The class name is a name of a class
that could be used in creating a Stored Procedure in PointBase. The naming convention follows
the hierarchical property naming convention and that is supported by
*"java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded*
by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
contain any white spaces.
Can you explain me what I must to do in order to solve this problem of spPermission.
Thanks. -
How to retrive a STANDARD stored procedure with java?
I have searched and searched, I have not found a direct, CLEAR, answer to this.
how do you call a standard, (not java) stored procedure from oracle database that requires input variables?
I have looked, searched and read and cannot find one simple example code, or message that explains this in clear concise info.
can some one please send me a email on this:
[email protected]
Don't bother leaving a message here, once I save this message and come back a day later its gone and can't be found by me..Hi... I am trying to create a dts package which is called by a stored procedure... How can i do this? IF possible can you please send me the code as well..
Thanks a ton...
Susan_Davis -
Writing to a temp table in a stored procedure with dynamic sql
Hi
I am writing into a temp table with dynamic sql:
select coloum_name into #temp_table from
+
@DestinationDBName+'.information_schema.tables
and then I am trying to use #temp_table in the procedure:
select coloum_name into #anotherTable from #temp_table
but I am getting an error that #temp_table is not recognized.
Can a temp table not be used in dynamic sql ?
How can I overcome this problem ?Temp Table Can used easily in Dynamic Query in SQL Server and here is small Exmaple you can check it and do like it
CREATE PROC test
AS
BEGIN
CREATE TABLE #T1
(ID int , NAME Nvarchar(50))
CREATE TABLE #T2
(ID int , NAME Nvarchar(50))
DECLARE @SQL NVARCHAR(MAX)='Insert into #T1
SELECT database_id , Name FROM Sys.Databases
Insert into #T2 Select ID , Name from #T1 '
EXEC SP_ExecuteSQL @SQL
SELECT * FROM #T2
DROP TABLE #T1
DROP TABLE #T2
END
Exec Test
If you found My reply is helpful for you please vote me
thanks
Mustafa EL-Masry
Principle Database Administrator & DB Analyst
SQL Server MCTS-MCITP
M| +966 54 399 0968
MostafaElmasry.Wordpress.Com -
Expose Stored Procedure with Dynamic Table Parameters
Hi,
I know Oracle 11g allows access via web service to all stored procedures.
The basic idea of what we intend is to create groups of users.
What I need, and I'm not sure if it's possible, is to expose a PLSQL that has the group's attributes and an xml:sequence of users that belong to that group. The procedure would be something like this:
TYPE user IS RECORD (
uid NUMBER,
name VARCHAR2(100),
TYPE users IS TABLE OF user INDEX BY BINARY_INTEGER;
PROCEDURE add_group(g_name IN VARCHAR2(100), g_users IN users, ...) IS
BEGIN
END;
The Procedure will be called from a BPEL Process as if it was a web service.
Q:
- Can this be done?
- How will it map users?
Thanks in advance :-)So, being as we don't have Oracle DB 11g that exposes WebServices natively to access the stored procedures, what would be the best way to access the stored procedure like a web service?
What we are thinking of doing now is http://guidoschmutz.wordpress.com/2010/08/08/oracle-service-bus-11g-and-db-adapter-a-different-more-integrated-approach/
Thanks again! -
SSRS - Stored procedure with Dynamic SQL Query
Am calling stored procedure in SSRS report. I have used Dynamic SQL query in stored procedure as I don't know the column name and column count. And I have used like below at end of the stored procedure "select * from ##temptable".
As I have used dynamic column, am not able to create report with this stored procedure. Can someone help me out to resolve this issue.
It will be highly appreciated if I get help.
ThanksI have tried everything. But nothing has worked out.
If I get solution for below issue, it would be highly appreciated.
"An error occurred during local report processing.
The definition of the repport 'Main Report' is invalid.
The report defintion is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition' which cannot be upgraded.
Thanks
Hello,
I would suggest you post the complete error message to us for further investigation, if you preview the report before you deploy you may get a more detailed error that will help diagnose the source of the problem.
This issue is more related to SQL Server Reporting Services, it's more appropriate to discuss it in the forum below:
https://social.technet.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlreportingservices
Don't forget to elaborate your issue with more detail.
For the manual column, it might be the calculated field in SSRS. Here is the article for your reference, please see:
http://technet.microsoft.com/en-us/library/dd239322(v=sql.110).aspx
Regards,
Elvis Long
TechNet Community Support -
How to change stored procedure with Table Valued Parameter
I am not sure how to change the normal stored procedure with Table Value Parameter.Do I have to create a separate Table or do I have to create a datatype. Can you please help me with this
ALTER PROCEDURE [dbo].[uspInsertorUpdateINF]
@dp_id char(32),
@dv_id char(32),
@em_number char(12),
@email varchar(50),
@emergency_relation char(32),
@option1 char(16),
@status char(20),
@em_id char(35),
@em_title varchar(64),
@date_hired datetime
AS
BEGIN
SET NOCOUNT ON;
MERGE [dbo].[em] AS [Targ]
USING (VALUES (@dp_id, @dv_id , @em_number, @email, @emergency_relation, @option1, @status, @em_id, @em_title, @date_hired))
AS [Sourc] (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired)
ON [Targ].em_id = [Sourc].em_id
WHEN MATCHED THEN
UPDATE
SET dp_id = [Sourc].dp_id,
dv_id = [Sourc].dv_id,
em_number = [Sourc].em_number,
email = [Sourc].email,
emergency_relation = [Sourc].emergency_relation,
option1 = [Sourc].option1,
status = [Sourc].status,
em_title = [Sourc].em_title,
date_hired = [Sourc].date_hired
WHEN NOT MATCHED BY TARGET THEN
INSERT (dp_id, dv_id, em_number, email, emergency_relation, option1, status, em_id, em_title,date_hired)
VALUES ([Sourc].dp_id, [Sourc].dv_id, [Sourc].em_number, [Sourc].email, [Sourc].emergency_relation, [Sourc].option1, [Sourc].status, [Sourc].em_id, [Sourc].em_title, [Sourc].date_hired);
END;It's not clear how you would change the procedure. But assuming that you want to replace the existing scalar parameters with tabular input, this is how you would do it. You first create a table type:
CREATE TYPE Insertor_type AS TABLE
(dp_id char(32),
dv_id char(32),
em_number char(12),
email varchar(50),
emergency_relation char(32),
option1 char(16),
status char(20),
em_id char(35),
em_title varchar(64),
date_hired datetime)
Then you change the procedure header:
ALTER PROCEDURE [dbo].[uspInsertorUpdateINF] @tvp Insertor_type READONLY AS
And finally you change the USING clause:
USING (SELECT dp_id, dv_id , em_number, email, emergency_relation, option1, status, em_id, em_title, date_hired
FROM @tvp) AS [Sourc] ON [Targ].em_id = [Sourc].em_id
The rest is fine as it is.
Erland Sommarskog, SQL Server MVP, [email protected] -
Calling a stored procedure with RAW and SYS_REFCURSOR
How do you call a stored procedure with the following input and output parameters?
create or replace PROCEDURE test
v_col1 IN NUMBER DEFAULT NULL ,
v_col2 IN VARCHAR2 DEFAULT NULL ,
v_col3 IN RAW DEFAULT NULL ,
v_vol4 IN DATE DEFAULT NULL,
cv_1 IN OUT SYS_REFCURSOR
OPEN cv_1 FOR
SELECT
lv_tmp1 aaaa ,
lv_tmp2 bbbb,
lv_tmp3 cccc
FROM DUAL ;
END;
Edited by: 925963 on Apr 6, 2012 10:50 AMDid you try just declaring the vars?
untested
declare
myCur SYS_REFCURSOR;
myRaw RAW(4);
BEGIN
test (0, 0, myRaw, sysdate, myCur);
END; -
Java- Stored Procedure with Call by Result
Hi Oracle-Community,
I am looking for some example Code how to use a Java-Stored Procedure with Out-Parameters. Don't get me wrong. I dont want to call a Procedure with Out Parameters from Java (there are a lot of examples for this out there) . I just want to implement the Call by Result concept in a Java-Stored Procedure. A Client will call this Procedure with some parameters and the Java Procedure will fill them. So my first question: is this possible? And my second Question: How to implement it?
Greetings.I found out a solution. It is very simple.
Just defining the parameters as java array (e.g. String[] P1). The first value (P1[0]) is the returned value.
At last just set in JDeveloper in the "Edit Method Signature" Dialog the parametermode to OUT.
The dialog can be found by rightclicking on the stored procedure in the dbexport file. You can read this
in Section 6 Publishing Java Classes With Call Specifications -> Setting Parameter Modes in
Oracle Database Java Developer's Guide. -
How to use stored procedure with many return results and variable with perl
Hi everybody,
i´m writtting now a Perl programm, wich use a oracle stored procedure with more than 1 result and 1 variable(I have to return 2 variable fpr each result). I don´t now how I can get it.I already search the web but I didn´t find.
My example:
PROCEDURE get_projects_and_sub_projects (
v_project_id IN INTEGER,
v_project_c_id OUT INTEGER,
v_project_id_find OUT VARCHAR2
IS
BEGIN
SELECT c_id, proj_id
INTO
v_project_c_id,
v_project_id_find
FROM t_projet
WHERE t_projet .ksa_pro_art_kbz = 'KU'
AND t_projet.proj_id LIKE v_project_id || '%';
EXCEPTION
WHEN NO_DATA_FOUND
THEN
v_project_c_id := NULL;
v_project_id_find := NULL;
WHEN OTHERS
THEN
kmessages.error (NULL,
'get_projects_and_sub_projects',
'Project-Name: ' || v_project_id,
'Errornumber: '
|| SQLCODE
|| ' Error: '
|| SQLERRM,
TRUE,
TRUE
raise_application_error (-20001,
'Error '
|| SQLCODE
|| ' get_projects_and_sub_projects: '
|| SQLERRM,
TRUE
END get_projects_and_sub_projects;
in Perl Program:
sub get_projects_unterprojects_name($$){
my ($db_handle, $proj_name_id) = @_; #$db_handle ist the DB Connection return value
my $db_proj_c_id;
my $db_proj_name;
eval{ my $csr = $db_handle->prepare(q{
BEGIN
pro_doc_ber.get_projects_and_sub_projects(:proj_name_id, :db_proj_c_id, :db_proj_name);
END;
# parameter value
$csr->bind_param(":proj_name_id", $proj_name_id);
# return values
$csr->bind_param_inout(":db_proj_c_id", \$db_proj_c_id, 11);
$csr->bind_param_inout(":db_proj_name", \$db_proj_name, 20);
$csr->execute(); };
But this didn´t work. Could somebody give me some idea?
Thank you
FelxSome additional info would probably be helpful.
What is your programming enviironment? Java?
In any case I suspect that you will need to use the OCI to deal with specific Oracle types such as user defined object types -- thats not standard ANSI SQL.
In Java I believe you need to use OPAQUE, there are some examples out there. I'm mostly a PL/SQL developer with some Java expereince so others here are more qualifed to answer your question more directly. -
How to call a AS/400 Stored Procedure with a BigDecimal Value?
Hi,
Could you pls tell me how to call a stored procedure on the AS/400 which request an input value of packed decimal(10P 4) value.
I have tried to convert it to a BigDecimal in Java and call the stored procedure as follows but it gave me a decimal point error on the AS/400.
Could you pls show me where I'm wrong in the following code.
Thanks
Jan
========Java program to call AS/400 Stored procedure with setBigDecimal()===========
//Assign the value to String
string sBDVal = "30"
//Convert the String value to BigDecimal
BigDecimal bdAmt = new BigDecimal(sBDVal);
//Call Stored Procedure with parameters,
CallableStatement callSP = conn.prepareCall("{call OSCUPDLENS(?,?,?)}");
// Set in parm values
callSP.setString(1,"Value 1");
callSP.setBigDecimal(2,bdAmt);
callSP.setString(3,"");
// Register out parameter
callSP.registerOutParameter(3, Types.CHAR);
// Execute call to stored procedure
callSP.execute();
// Retrieve out parameters
sErrFlag = callSP.getString(3).trim();
========================Create Stored Procedure on AS/400===========================
c/EXEC SQL
c+ CREATE PROCEDURE TESTSPROC
c+ (IN VAL1 CHAR ( 8),
c+ IN BDAMT DEC (10, 4),
C+ INOUT ERR CHAR ( 1))
C+ LANGUAGE RPGLE NOT
C+ DETERMINISTIC NO SQL EXTERNAL NAME TESTSPROC PARAMETER STYLE
C+ GENERAL
c/END-EXEC
======RPG program on AS/400 to accept the BigDecimal value to a Packed decimal======
* Initialize the i/p parameter
DP#VAL1 S 8A
DP#AMT S 10P 4
DP#ERR S 1A
C*Input parameters
C *ENTRY PLIST
C PARM P#VAL1
C PARM P#AMT
C PARM P#ERRCould you pls show me where I'm wrong in the following codeI don't know, you're doing a lot of things I have never tried. But "decimal data error" most likely means that the stored procedure is expecting packed data and the driver is giving it zoned data, or vice versa. You could confirm that by dumping your variables inside your RPG. If that is your problem, you could work around it by redefining your BDAMT parameter as integer or string and reformatting it in the RPG.
-
How to execute plsql stored procedure with DbAccess
sessionInfo object can give DbAccess .through
which u can use javax.infobus.DbAccess API to
execute sql satement and stored procedures according to infobus API .iam able to
execute simple query by using executeCommand() ,executeRetrival() ?. how to execute stored procedures with executeRetrieval() .
how to take in and out parameters
suggestions are welcome
waiting for your suggestionsI am also looking for the same.
Did you get any info on this
Thanks,
jagan
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by chandra sekhar ([email protected]):
sessionInfo object can give DbAccess .through
which u can use javax.infobus.DbAccess API to
execute sql satement and stored procedures according to infobus API .iam able to
execute simple query by using executeCommand() ,executeRetrival() ?. how to execute stored procedures with executeRetrieval() .
how to take in and out parameters
suggestions are welcome
waiting for your suggestions<HR></BLOCKQUOTE>
null -
How to call stored procedure with multiple parameters in an HTML expression
Hi, Guys:
Can you show me an example to call stored procedure with multiple parameters in an HTML expression? I need to rewrite a procedure to display multiple pictures of one person stored in database by clicking button.
The orginal HTML expression is :
<img src="#OWNER#.dl_sor_image?p_offender_id=#OFFENDER_ID#" width="75" height="75">which calls a procedure as:
procedure dl_sor_image (p_offender_id IN NUMBER)now I rewrite it as:
PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number)could anyone tell me the format for the html expression to pass multiple parameters?
Thanks a lot.
SamHi:
Thanks for your help! Your question is what I am trying hard now. Current procedure can only display one picture per person, however, I am supposed to write a new procedure which displays multiple pictures for one person. When user click a button on report, APEX should call this procedure and returns next picture of the same person. The table is SOR_image. However, I rewrite the HTML expression as follows to test to display the second image.
<img src="#OWNER#.Sor_Display_Current_Image?p_n_Offender_id=#OFFENDER_ID#&p_n_image_Count=2" width="75" height="75"> The procedure code is complied OK as follows:
create or replace
PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number) AS
v_mime_type VARCHAR2(48);
v_length NUMBER;
v_name VARCHAR2(2000);
v_image BLOB;
v_counter number:=0;
cursor cur_All_Images_of_Offender is
SELECT 'IMAGE/JPEG' mime_type, dbms_lob.getlength(image) as image_length, image
FROM sor_image
WHERE offender_id = p_n_Offender_id;
rec_Image_of_Offender cur_All_Images_of_Offender%ROWTYPE;
BEGIN
open cur_All_Images_of_Offender;
loop
fetch cur_All_Images_of_Offender into rec_Image_of_Offender;
v_counter:=v_counter+1;
if (v_counter=p_n_image_Count) then
owa_util.mime_header(nvl(rec_Image_of_Offender.mime_type, 'application/octet'), FALSE);
htp.p('Content-length: '||rec_Image_of_Offender.image_length);
owa_util.http_header_close;
wpg_docload.download_file (rec_Image_of_Offender.image);
end if;
exit when ((cur_All_Images_of_Offender%NOTFOUND) or (v_counter>=p_n_image_Count));
end loop;
close cur_All_Images_of_Offender;
END Sor_Display_Current_Image; The procedure just open a cursor to fetch the images belong to the same person, and use wpg_docload.download_file function to display the image specified. But it never works. It is strange because even I use exactly same code as before but change procedure name, Oracle APEX cannot display an image. Is this due to anything such as make file configuration in APEX?
Thanks
Sam -
Using stored procedures with a timestamp parameter with Delphi and ADO
Dear Oracle experts,
I have a problem concerning using a stored procedure with Delphi.
I try to use a stored procedure which hast two input parameters ( a integer and a timestamp).
The timestamp parameter is my problem since I would like to use the "to_timestamp"
Oracle-function to create the timestamp parameter to be inserted into my procedure.
If I insert the to_timestamp statement as a adodatetime I have to perform the conversion to the oracle timestamp in my application.
If I want to use the to_timestamp statement I have to use the ftstring datatype but in that case I get an error because I use a string as input for my procedure were it awaits a timestamp.
So the problem seems to be that the function call "to_timestamp" is not interpreted if it is transferred through my ADO component.
Do you know how to use a procedure with Delphi (ADO) with a function as input parameter ?
Best regards,
Daniel Wetzler
P.S. :
This is the Delphi code to use my Procedure.
FactsTempDS:=TADODataset.Create(nil);
Sproc1 := TAdoStoredProc.Create(nil);
Sproc1.Connection := TDBConnection(strlistConnectionstrings.objects[iConnectionIndex]).Connection;
Sproc1.ProcedureName := 'ECSPACKAGE.PROCFINDINITIALSWITCHSTATE';
Sproc1.Parameters.CreateParameter ('SwitchID',ftInteger,pdinput,0,0);
//Sproc1.Parameters.CreateParameter ('StartTime',ftdatetime,pdinput,50,0);
Sproc1.Parameters.CreateParameter ('StartTime',ftString,pdinput,50,0);
Sproc1.Parameters.Findparam('SwitchID').value:=SwitchID;
Sproc1.Parameters.FindParam('StartTime').Value:= 'to_timestamp(''2005/12/30 19:36:21'', ''YYYY/MM/DD HH:MI:SS'')';
Sproc1.CursorType := ctKeyset;
Sproc1.ExecuteOptions:=[];
Sproc1.Open;
Sproc1.Connection := nil;
FactsTempDS.Recordset:= sproc1.Recordset;
if FactsTempDS.RecordCount=0
then raise Exception.Create('No line switch variable found for switch '+IntToStr(SwitchID)+' before starttime. Check BDE dump filter.')I have my entity manager setup in a singleton.
I'm finding it's costly to generate the emf, but if I don't close the em (enitity manager) and emf (entity manager factory) my open cursor count climbs until I exceed the max number of open cursors on the database (11g RAC)
I'm committing the connection, and uow, and closing the em at the end of each call.
But until I close the emf, the open cursors aren't released.
TransactionhistoryPkg tranPkg = new TransactionhistoryPkg(conn); //Class created over database package via JPublisher
tranPkg.transactionhistoryInsSp(insertTrans.getCardId()); // executes db package
tranPkg.closeConnection();
conn.commit();
uow.commit();
uow.getAccessor().decrementCallCount();
em.close();
Am I missing something really obvious here??
btw - I found this link helpful in troubleshooting the max cursors issue: https://support.bea.com/application_content/product_portlets/support_patterns/wls/InvestigatingORA-1000MaximumOpenCursorsExceededPattern.html
Maybe you are looking for
-
Why does not my servo motor work?
Hello all, I can work my servo motors, so I have two questions. Firstly, I'm using PXI-7340 & UMI 7764 to control AC motor on servo motor (TAMAGAWA SEIKI co.), But in MAX, motor doesn't work with servo type.And there is no signal between AnalogOutput
-
ITunes for PC won't recognize iPad
Running Vista Home Premium 32 bit. No version of iTunes (version 10, 11, or even the one just released) will recognize iPad1. AMDS service says Starting but never completes. Get an AMDS AppCrash message on Fault Module Name rpcrt4.dll. It used to
-
ITunes started re-downloading old TV episodes.
My iTunes just started re-downloading some old TV episodes, that I already purchased. It is currently downloading 18 episodes of NCIS season 5, I purchased all 18 about a year ago, and all 18 original downloaded episodes are still in my iTunes librar
-
Generate lower-case nodes in XML
Hi, In my PL/SQL procedures, I generate XML files based on SQL queries, like this: SELECT XMLELEMENT ("web_vpreparations", XMLAGG( XMLELEMENT ("web_vpreparation", XMLFOREST (CODE as "code", COMMERCIAL_NAME as "commercial_name", As you can see, I rena
-
Activation of BC-sets through eCATT
Hi all, Anyone has idea or suggestion on how to activate BC-sets using eCATT? regards, Alex.