stored procedure help!
Hello world
I want to be able to store data in a database using a form.
A stored procedure has been created to insert parameters in a database table. I am told that I can trigger a sql script with the name of the store procedure followed by the my HTML form parameter.
I don't know how I'd go all trigger the SQL script in HTML. I am using asp and dreamweaver.
I never did that before and I'm really stuck! Any help or advice are appreciated!
Thank you very much
You don't mention which language you are using. In any case, use a command object to execute a stored procedure:
http://support.Microsoft.com/kb/164485
Tags: Dreamweaver
Similar Questions
-
Hello
I'm new to the development of Oracle.
I have the following scenario for which I need your help/suggestions to write a stored procedure.
A load process in a table unfolds with about million files once a month.
I have a LOG Table to record the events of job loading IE when it starts, when it stops, status etc. with the following columns
job_name, job_status, start_time, end_time, date, flag
work focuses on the work that is in charge of the table.
Based on the values in this table, I want to develop a stored procedure sql pl verifies the status of the job and does the following
When the flag = R (assume for running job) set it to run the job again as 1 hour later... if its still ongoing then 1 hour later... so now up to 5 trys
= F (Finished)
= E (error problem) launch the load immediately
The flag State values noted above are not binding... values just to give you an idea... all the other variables to use to store procedure or any new passes in the table... .suggestions are welcome for these values as well.
Basically, I would like the stored procedure to be called at some point... say SUNDAY at 06:00 and check the STATUS of the INDICATOR/table newspaper column and run.
In short, I like the pl sql store procedure to use table to log and monitor the loading process.
Structure/Basic code stored procedure for this requirement or a stored procedure that you have met similar requirements are welcome.
Thanks in advance.
Published by: user13517642 on March 23, 2011 13:28
Published by: user13517642 on March 23, 2011 13:29Your process or procedure shud look like - [not tested]
DECLARE l_flag LOG.flag%TYPE; BEGIN SELECT flag INTO l_flag FROM LOG WHERE job_name = p_job_name; WHILE l_flag = 'R' LOOP DBMS_LOCK.sleep (3600); --3600secs in 1hr SELECT flag INTO l_flag FROM LOG WHERE job_name = p_job_name; END LOOP; IF (l_flag IN ('F', 'E')) THEN --<
> END IF; END; Look at the following to find out how to plan work-
http://www.oradev.com/dbms_scheduler.jsp
Published by: Sri on 23 March 2011 14:10
Published by: Sri on 23 March 2011 14:11
-
Basic stored procedure helps - not the return data
Hi all:
To be fair, I come from a SQL Server environment and have never written anything for PL/SQL / Oracle before, this is my first attempt, so if nothing is better or more effective, please let me know. The immediate problem I'm having is, I have the following stored procedure, and all I want to do is return the data in the table, so that I can fill my DataSet in code. But when I run the code against this stored procedure, it still don't bring back any data (if I just do a standard "SELECT * FROM lkAllocation", I get the results, so I know data are there and the connection is good). If execution of the procedure in my window in Oracle SQL Developer (call PAYSOL.spallocationselectall ();), my results displays no data as well. What is the problem with this stored procedure?
create or replace
PROCEDURE spAllocationSelectAll IS
Whole AllocationID;
AllocationName Varchar2 (50);
BEGIN
AllocationID: = 0;
AllocationName: = ";
SELECT
AllocationID,
AllocationName
IN
AllocationID,
AllocationName
Of
lkAllocation
ORDER BY
AllocationName;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHILE OTHERS THEN
-Consider recording the error and then re-raise
LIFT;
END spAllocationSelectAll;Well, I'm not really in .net (I would participate in another forum so ;)), but this might be useful?
Value (Oracle.DataAccess.Types) System.Data.DbType OracleDbType OracleRefCursor Object RefCursor
http://download.Oracle.com/docs/CD/B19306_01/win.102/b14307/featOraCommand.htm#g1025379
http://download.Oracle.com/docs/CD/B19306_01/win.102/b14307/featOraCommand.htm#g1025072Perhaps the [forum Windows and .net | http://forums.oracle.com/forums/category.jspa?categoryID=44] is worth a try as well.
-
How to do this consult of a hierarchical recursion on a stored procedure? Help!
Please help me, im using oracle 11g
I have 2 tables
Department table (number of I_Depto (1), number of E_Depto (30));
i_depto e_dept
1 Finance
2 shopping
3 sistemas
4 rh
Empleado table (I_Emp number (5), N_Emp varchar (20), Q_salary (8.2) number, number of I_boss (5), the number of I_Depto (1));
i_emp n_emp q_salary i_boss i_dept
Juan 100 300 null 1
200 100 100 1 Pedro
300 Angélique 150 100 1
400 70 300 2 alberto
500 60 300 2 Miriam
600 3 500 80 moises
And yet, I have 3 conditions:
If the boss has 3 employees or more, he has increased his salary by 20%
If the boss have 2 employees, there was an increase in his salary of 10%
And if 0 or 1 employee, there is an increase of 5%
herarchical diagram is like that
-> Pedro Juan
Juan-> Angelica-> Alberto
Juan-Angelica-Miriam-Moses > > >
I have to present the name of the Department (e_depto) in the console and the result should be like this;
SQL > exec p_example ('finance');
Employees of BOSS of the boss pay increase employees (name) boss of the salary increase employee employees employees
juan 6 60 pedro 0 5
juan 6 60 angelica 3 45
pedro 0 5 NULL 0 0
Angelica 3 45 alberto 0 5
Anglica 3 45 miriam 1 3
SQL > exec p_example ('shopping');
Employees of BOSS of the boss pay increase employees (name) boss of the salary increase employee employees employees
alberto 0 3.5 - 0 0
miriam 1 3 moises 0 4
SQL > exec p_example('sistemas);
Employees of BOSS of the boss pay increase employees (name) boss of the salary increase employee employees employees
moises 0 4 - 0 0
His need to create a recurrence, stored procedure
The query I have is this, but it only shows me that the boss and the boss employees.
createor replace procedure deptos (depto varchar) as
t_boss varchar (49);
t_employ varchar (50);
cursor c_depto (t_depto varchar) is
Select a.n_emp boss, employee of b.n_emp
of empleado a, b empleado, departamento d
where a.i_emp = b.i_boss (+) and d.i_dept = a.i_dept
and a.i_emp in (select i_EMP from empleado where i_dept = t_dept);
Start
Open c_depto (depto);
loop
extract the c_depto in t_boss t_employ;
When the output c_depto % notfound;
dbms_output.put_line (t_boss |) Chr (9) | Chr (9) | t_employ);
end loop;
end;
/
Hello
I know it's a pain to post CREATE TABLE and INSERT statements for the sample data. Think about why it is necessary: that people who want to help you can recreate the problem and test their ideas. If you post statements that do not work, which does not recreate the problem or to test their ideas. Test (and, if necessary, correct) your statements before committing. Make sure all quotes are balanced.
I don't understand the desired output. For example, when n_emp = 'Juan', why is-employees_ofthe_boss = 6, 5 no? When n_emp is 'Angelic', why is-salary_increase = 45, not 30? When n_emp = 'Alberto', why is-salary_increase = 5, not 3.5?
You may want something like this:
WITH universe_dup AS
(
SELECT i_emp, n_emp, q_sueldo, i_jefe
SYS_CONNECT_BY_PATH (i_emp, ","). ',' AS line
, LEVEL AS lvl
Of empleado
START WITH (IN) i_depto
SELECT i_depto
OF Department
WHERE e_depto = 'Finance' - or what you want
)
CONNECT BY i_jefe = PRIOR i_emp
)
universe
(
SELECT i_emp, n_emp, q_sueldo, i_jefe
MAX (lineage) DUNGEON (DENSE_RANK LAST ORDER BY lvl) AS lineage
MIN AS min_level (lvl)
Of universe_dup
GROUP of i_emp, n_emp, q_sueldo, i_jefe
)
got_salary_increase AS
(
SELECT a.i_emp, a.n_emp, a.i_jefe, a.min_level
EARL of (d.i_emp) AS employee_cnt
, a.q_sueldo * CASE
WHEN COUNT (d.i_emp) > = 3 PUIS.2
WHEN COUNT (d.i_emp) = 2 PUIS.1
OF AUTRE.05
END AS salary_increase
OF the universe a
LEFT OUTER JOIN universe d ON d.lineage LIKE '%', | a.i_emp | ',%'
AND d.i_emp <> a.i_emp
GROUP OF a.i_emp, a.n_emp, a.i_jefe, a.min_level, a.q_sueldo
)
SELECT p.n_emp AS boss
p.employee_cnt AS employees_ofthe_boss
p.salary_increase AS salary_increase_boss
c.n_emp AS employees_name
, NVL (c.employee_cnt, 0) AS employees_ofthe_employee
, NVL (c.salary_increase, 0) AS salary_increase_employee
OF got_salary_increase P
LEFT OUTER JOIN got_salary_increase c ON c.i_jefe = p.i_emp
WHERE p.min_level = 1
;
Depending on your data and your needs, it may be more effective to do "START WITH i_jefe IS NULL", as one of the above. I guess "START WITH i_depto (...)" in the largest tables, when efficiency is more important.
-
Help me for oracle stored procedure cursor
Hello
I am newbie to sql server and oracle 9i stored procedure cursor
I have a stored procedure that has the sql server format
can someone help me convert this
Create procedure Insert_profilebasicdetail
(
@isubprofileid as int,
@Copyisubprofileid as int,
@itranno as int,
)
As
Begin
Declare @IncKeyId as int
Declare @tempkeyId as int
Set @IncKeyId = (select isNull (Max (ikeyId), 0) as profilebasicdetail MaxKeyId)
Declare TempInsert cursor for select ikeyId - iprofileid, iquestionid, vquestionans, cstatusindi, dmodifyon, imodifyby, iyear
from profilebasicdetail where [isubprofileid=@Copyisubprofileid|mailto:isubprofileid=@Copyisubprofileid] and [itranno=@itranno|mailto:itranno=@itranno]
Open TempInsert
the extraction of TempInsert in @tempkeyId
While @fetch_Status = 0
Begin
Set @IncKeyId = @IncKeyId + 1
Insert into profilebasicdetail
(ikeyid, iprofileid, iquestionid, vquestionans, cstatusindi, dmodifyon, imodifyby, itranno, iyear, isubprofileid)
values (select @IncKeyId, iprofileid, iquestionid, vquestionans, cstatusindi, dmodifyon, imodifyby, '1',
profilebasicdetail iYear,@isubprofileid where [ikeyId=@tempkeyId|mailto:ikeyId=@tempkeyId])
extract the following TempInsert in @tempkeyId
End
End
-----------------------------------------------
really necessary
Hello
Check this link...
http://www.UNIX.com.UA/orelly/Oracle/PROG2/ch07_04.htm
http://www.techonthenet.com/Oracle/loops/cursor_for.phpyou code will look like
CREATE OR REPPLACE PROCEDURE Insert_profilebasicdetail
(isubprofileid in INT,
Copyisubprofileid in INT,
itranno in INT
)
IS
INT IncKeyId;
INT tempkeyId;CURSOR c1 IS
SELECT ikeyId
OF profilebasicdetail WHERE the Copyisubprofileid mailto:isubprofileid=
AND mailto:itranno=itranno
BEGINSELECT MaxKeyId
IN IncKeyId
OF (NVL (MAX (ikeyId), 0) SELECT MaxKeyId)
(FROM profilebasicdetail);
/*
SET IncKeyId = (SELECT isNull (MAX (ikeyId), 0) AS MaxKeyId FROM profilebasicdetail)
*/FOR rec in c1
LOOPIF (rec.ikeyId IS NOT NULL) THEN
IncKeyId: = IncKeyId + 1;
-Don't you insert here
/*
INSERT INTO profilebasicdetail
ikeyid, iprofileid, iquestionid, vquestionans, cstatusindi, dmodifyon, imodifyby, itranno, iyear, isubprofileid)
VALUES (SELECT @IncKeyId, iprofileid, iquestionid, vquestionans, cstatusindi, dmodifyon, imodifyby, '1',
iYear,@isubprofileid FROM profilebasicdetail WHERE mailto:ikeyId=@tempkeyId) * /.
END IF;END LOOP;
END Insert_profilebasicdetail;-Pavan Kumar N
Published by: pounet, Sep 15, 2008 16:05
-
Hi all
I am creating a simple stored procedure that updates a table which has initially been removed
CREATE PROCEDURE CLASSTEST_01 IS
BEGIN
delete from temp_test_01;
Select * from TEMP_CLASS_SCORE in temp_test_01;
END CLASSTEST_01;
However, it will not create.
Pls can someone check if there is something wrong with the statement
Thank youThere is no need of stored procedure. All you need is:
delete from temp_test_01; insert into temp_test_01 select * from TEMP_CLASS_SCORE;
Or:
truncate table temp_test_01; insert into temp_test_01 select * from TEMP_CLASS_SCORE;
But if you decide to create one:
CREATE OR REPLACE PROCEDURE CLASSTEST_01 IS BEGIN delete from temp_test_01; insert into temp_test_01 select * from TEMP_CLASS_SCORE; END CLASSTEST_01; /
SY.
-
Need help, run the stored procedure in ASP.
I have a web page in which I would use a query like http://ereply.us/q/l.asp?id=383966476 string
It directs the user to a page that contains the following code:
<!-queue = "database_connection.asp #include" - > "
< %
If not isempty (request.querystring ("id")) then
SQL = "exec dbo.fp_qr_code @sequence (request.querystring ("id")) =" "
If rs.state = 1 then rs.close
RS. Open sql, conn, 3, 2
If rs.recordcount <>0 then
session("Name") = rs ("name")
session("JobID") = rs ("jobid")
session("SEQ") = rs ("seq")
If rs ("id") <>"" then the answer. " Redirect ("index.asp")
end if
end if
% >It queries a SQL database to return the value of 'name '. In turn, according to the code of the user should be directed to 'Index.asp' that contains:
Welcome < % response.write (session("name")) % >
And the page you should see the page with"Welcome". Instead, I get a server 500 error. The stored procedure runs as a stand-alone query in SQL Management Studio.
Any ideas would be greatly appreciated.
I solved this. This is the query that worked:
< %="">< br="">SQL = "" exec fp_qr_code ' "& request.querystring ("id") &" ' " < br=""> set rs = Conn.Execute (sql) < br=""> if rs.eof then response.write ("no registration") < br=""> while not rs.eof" ""
response.write (("name") rs)response.write (("imgname") rs)
response.write (rs ('url'))
RS.MoveNext
Wend < br=""> %> -
Need help to convert a sql query to a stored procedure
I have a task to convert a script sql in a stored precedure. The sql with different pr_id test_type are below. And the stored procedure must accept a pr_id and a test_type as an argument. Test type will be 3 for ATI and 2 for TI. It must return a single value, the greatest distance calculated to fill the value of tap. It is possible that they will pass a prid, test_type combination that will have all the records in the dsltdr table.
{
SELECT pw,
Round ((DECODE (t.rfltype1, 5, t.rfldist1,)))
DECODE (t.rfltype2, 5, t.rfldist2,)
DECODE (t.rfltype3, 5, t.rfldist3,)
DECODE (t.rfltype4, 5, t.rfldist4,)
DECODE (t.rfltype5, 5, t.rfldist5,)
DECODE (t.rfltype6, 5, t.rfldist6,)
DECODE (t.rfltype7, 5, t.rfldist7,)
DECODE (t.rfltype8, 5, t.rfldist8,)
NULL)))
(- launch_start) * distk * vop, 2) dist
OF dsltdr t
WHERE pr_id = 464529581
AND test_type = 3
ORDER BY pw CSA;
}
SELECT pw,
Round ((DECODE (t.rfltype1, 5, t.rfldist1,)))
DECODE (t.rfltype2, 5, t.rfldist2,)
DECODE (t.rfltype3, 5, t.rfldist3,)
DECODE (t.rfltype4, 5, t.rfldist4,)
DECODE (t.rfltype5, 5, t.rfldist5,)
DECODE (t.rfltype6, 5, t.rfldist6,)
DECODE (t.rfltype7, 5, t.rfldist7,)
DECODE (t.rfltype8, 5, t.rfldist8,)
NULL)))
(- launch_start) * distk * vop, 2) dist
OF dsltdr t
WHERE pr_id = 464528353
AND test_type = 3
ORDER BY pw CSA;
SELECT pw,
Round ((DECODE (t.rfltype1, 5, t.rfldist1,)))
DECODE (t.rfltype2, 5, t.rfldist2,)
DECODE (t.rfltype3, 5, t.rfldist3,)
DECODE (t.rfltype4, 5, t.rfldist4,)
DECODE (t.rfltype5, 5, t.rfldist5,)
DECODE (t.rfltype6, 5, t.rfldist6,)
DECODE (t.rfltype7, 5, t.rfldist7,)
DECODE (t.rfltype8, 5, t.rfldist8,)
NULL)))
(- launch_start) * distk * vop, 2) dist
OF dsltdr t
WHERE pr_id = 464527142
AND test_type = 2
ORDER BY pw CSA;
SELECT pw,
Round ((DECODE (t.rfltype1, 5, t.rfldist1,)))
DECODE (t.rfltype2, 5, t.rfldist2,)
DECODE (t.rfltype3, 5, t.rfldist3,)
DECODE (t.rfltype4, 5, t.rfldist4,)
DECODE (t.rfltype5, 5, t.rfldist5,)
DECODE (t.rfltype6, 5, t.rfldist6,)
DECODE (t.rfltype7, 5, t.rfldist7,)
DECODE (t.rfltype8, 5, t.rfldist8,)
NULL)))
(- launch_start) * distk * vop, 2) dist
OF dsltdr t
WHERE pr_id = 464528984
AND test_type = 2
ORDER BY pw CSA;
>
SELECT pw,
Round ((DECODE (t.rfltype1, 5, t.rfldist1,)))
DECODE (t.rfltype2, 5, t.rfldist2,)
DECODE (t.rfltype3, 5, t.rfldist3,)
DECODE (t.rfltype4, 5, t.rfldist4,)
DECODE (t.rfltype5, 5, t.rfldist5,)
DECODE (t.rfltype6, 5, t.rfldist6,)
DECODE (t.rfltype7, 5, t.rfldist7,)
DECODE (t.rfltype8, 5, t.rfldist8,)
NULL)))
(- launch_start) * distk * vop, 2) dist
OF dsltdr t
WHERE pr_id = 464529918
AND test_type = 2
ORDER BY pw CSA;
How to start with?
Thanks in advance.I removed the dbms_output statement because it does not seem to turn it on. If you do this from sqlplus
Make sure that you type "serverout on" and press return.declare vPW number := 0 ; vDistance number := 0 ; begin sp_dsl_test(3,'12345',vDistance,vPW) ; DBMS_OUTPUT.PUT_LINE('Distance = '|| vDistance || ' PW = '|| vPW); end;
Published by: FlyingGuy on March 3, 2011 14:24
-
Hello
I have a problem to transfer content to an XML file in a MS SQL database through a stored procedure data/fixed. I am able to transfer the content of the file using method...
HSTMT = DBPrepareSQL (hdbc, EXEC usp_InsertReport "
... ");resCode = DBExecutePreparedSQL (hstmt);
resCode = DBClosePreparedSQL (hstmt);
... but in this case, I am not able to read the return value of the stored procedure.
I tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL), but I miss a xml data type?
No idea how to solve my problem?
Cake of KR
DianaS salvation,
Thanks for your comments. During this time I found another way which fullfill my needs:
resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_TEXT);
sprintf (sz_SqlStatement, "DECLARE @TESTID INT EXEC @TESTID = usp_InsertReport ' SELECT 'RetVal' %s = @TESTID", sz_Buffer ");
HSTMT = DBActivateSQL (hdbc, sz_SqlStatement);While ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS)
{
/ * Enter values in the record. */
resCode = DBGetColInt (hstmt, 1, & s32_TestId);
}resCode = DBDeactivateSQL (hstmt);
sz_Buffer is the content of the XML file.
Cake of KR
-
SQL stored procedure input and output parameters
Hello Gang,
My dead end trying to call a stored procedure in SQL Server 2008 with the LV database tool.
for purposes of experimentation, I've created a small procedure with an input parameter that returns an integer as return value. It works describing a query, but all attempts at LV produce an error-2147217900 when executing query VI. I did find examples of that.
Sending a bunch of parameters to a stored procedure and checking the value of return seems to be pretty common stuff.
I'll appreciate any help.
Thank you
Roger
Hi Roger,
There are a few prerequisites which I will list below. If you have not checked these things, so don't hesitate, as your hiccups can be there.
Prerequisites:
- Ensure that you can read from a table in the database to verify that you can access the database (user permissions) and ensure that your login details are correct. Among other things, make sure that the. DSN switches to the correct database. (See the simple example below, SQL Select.vi)
- Make sure that your user (if you use SQL authentication) has permissions to run the STORED procedure by running the procedure in SQL Server Management Studio (you seem to have already done this)
Example by calling a procedure without parameters (attached as SPROC_No_Parameters.vi):
Example by calling a procedure with parameters (attached as SPROC_Parameters.vi):
An article on the execution of stored procedures is here:
http://digital.NI.com/public.nsf/allkb/07FD130746083E0686257300006326C4
Don't forget to download the example VI since it includes the cases where you want an output parameter of the procedure rather than a table.
I tested these against two very simple SPROCs and it worked fine (on SQL Server 2005, but 2008 should be the same). Stored procedures have been:
CREATE PROCEDURE [dbo]. [GetContacts]
AS
BEGIN
-SET NOCOUNT ON added to avoid additional results sets from
-interfering with SELECT statements.
SET NOCOUNT ON;-Controls insert for procedure here
SELECT * FROM Contacts
ENDand
CREATE PROCEDURE [dbo]. [MultiplyAges]
@param1 INT = 1
AS
BEGIN
-SET NOCOUNT ON added to avoid additional results sets from
-interfering with SELECT statements.
SET NOCOUNT ON;-Controls insert for procedure here
SELECT (age * @param1) OF Contacts
ENDI would like to know if these examples work for you or if you have any other questions. Don't forget to go through this KB article and articles related to it, they should cover other situations.
Matt
- Ensure that you can read from a table in the database to verify that you can access the database (user permissions) and ensure that your login details are correct. Among other things, make sure that the. DSN switches to the correct database. (See the simple example below, SQL Select.vi)
-
Call the stored procedure, and bind parameters by name
Hello
I use the Oracle ODBC 12 c driver to pass values from one Interface to our database Oracle 11.2. The Interface software collects data from modbus protocoll and calls a stored procedure. Right now my syntax to call the stored procedure looks like this:
CALL procedure-name ('STRING', 'Timestamp as String', numValue1);
It works very well. Now, I have to add a default setting to my procedure. To stay flexible to make other changes, I want to call the procedure and bind the parameters by name. Release 10.2.0.1.0 ISC ODBC Notes:
Added support for the named parameter, binding the parameters by name. ODBC Oracle driver now allows the application to specify the parameters of a stored procedure by name, in the procedure call. Named parameters are to be used in calls to stored procedures and should not be used in other SQL statements.
So, it shouldn't be a problem to use named notation, but how do I do this in ODBC? I tried like this, but oracle returns an ora-00936 error of missing expression:
call procedure-name (paramName1 = > 'STRING',= paramName2 > 'Timestamp as String',paramName3 = > numValue1).
Thank you for your help.
Finally, I was able to find the error. The syntax of the statement was very good. The problem was caused by another declaration that I edited before and the error has not attracted Attention immediately.
Thanks for reading and looking for an answer.
-
My source data in the remote database schema (say C3.case). And I am trying to insert data of this CASE table in my database table (for example SIMS.case) I use the stored procedure to load the data.
I was going through the documentation and I thought that the creation of MV is not possible in this case is the source table in the remote database schema. Is this correct?
or create a link DB is the only option available to access the remote database schema table.
Thank you.
Hello
2929538 wrote:
My apologies for the bad conventions help. I meant remote schema.
the required data and the destination table, the two are in oracle, but in totally different schemas.
Yes, you said a table is in a scheme called C3, and the other is in a schema called SIMS. Are these schemas in the same database or in different databases?
If they are in the same database, then you do not have a database link. Or the other schema can reference tables in the other qualifying names correctly, for example
SELECT *.
OF C3. case_studies
...
assuming that the right privileges have been granted.
If the schemas are in different databases, a database link is the best way to access data in a database in a different database.
Without a database link, you will probably use some kind of use outside the database to write the data to a database, the file if necessary, transport and read in other databases. DataPump files of images or CSV files, as Paulzip said in answer to #1, could be used for this.
-
Creating classic report to the stored procedure.
How can we create a report based on a stored procedure out parameter.
Can someone please help.
Thank you
Nani.
Nani4850 wrote:
Out parameter is a multi-level object type.
I found a way to sort of basis a report on the parameter OUT procedure. The approach is:
1. call the procedure in a process before PL/SQL areas, convert the object returned in an XML document and store in a collection XMLType column:
declare k_rate_query varchar2(255) := 'RATE_QUERY'; l_rate_type_code number; l_rate_query rate_rec; l_xml xmltype; l_seq_id number; begin l_rate_type_code := to_number(:p1_rate_type_code); api_pkg.rate_query(l_rate_type_code, l_rate_query); l_xml := xmltype.createXML(l_rate_query); if not apex_collection.collection_exists(k_rate_query) then apex_collection.create_collection(k_rate_query); end if; select seq_id into l_seq_id from apex_collections where collection_name = k_rate_query and n001 = l_rate_type_code; apex_collection.update_member_attribute(k_rate_query, l_seq_id, 1, l_xml); exception when no_data_found then apex_collection.add_member( p_collection_name => k_rate_query , p_n001 => l_rate_type_code , p_xmltype001 => l_xml); end;
2. use a SQL/XML query on the XML collection in the region report source:
select rq.* from apex_collections ac , xmltable( '/RATE_REC/RATE_TBL/RATE_REC_TYPE' passing ac.xmltype001 columns action_code varchar2(20) path 'ACTION_CODE' , rate_key number path 'RATE_KEY' , rate_type_code varchar2(5) path 'RATE_TYPE_CODE' , program_key varchar2(12) path 'PROGRAM_KEY' , rate number(8,5) path 'RATE' , effective_date date path 'EFFECTIVE_DATE' , current_yn varchar2(1) path 'CURRENT_YN' , non_current_dt date path 'NON_CURRENT_DT' , non_current_by_id varchar2(4) path 'NON_CURRENT_BY_ID' , non_current_reason varchar2(400) path 'NON_CURRENT_REASON') rq where ac.collection_name = 'RATE_QUERY' and ac.n001 = to_number(:p1_rate_type_code)
-
How to create simultaneous program of type PL/SQL stored procedure?
I have the procedure to reset sequence as below:
CREATE OR REPLACE PROCEDURE DEV_RESET_XX IS
V_NEXT_VAL1 NUMBER;
BEGIN
RUN IMMEDIATELY "ALTER SEQUENCE DEV_RECEIPT_S1 MINVALUE 0';"
RUN IMMEDIATELY "SELECT DEV_RECEIPT_S1. DOUBLE NEXTVAL ' IN V_NEXT_VAL1;
RUN IMMEDIATELY "ALTER SEQUENCE DEV_RECEIPT_S1 INCREMENT BY ' |" -V_NEXT_VAL1;
RUN IMMEDIATELY "SELECT DEV_RECEIPT_S1. DOUBLE NEXTVAL ' IN V_NEXT_VAL1;
RUN IMMEDIATELY "ALTER SEQUENCE INCREMENT DEV_RECEIPT_S1 1 ';"
END DEV_RESET_XX;
And if I run this query don't use PL/SQL, no problem and success.
EXEC DEV_RESET_XX
And then I want to create simultaneous program for this procedure.
1. create the executable program
-Methods: PL/SQL, stored procedure
2. create the simultaneous program
-Call the executable program
-Nothing parameter
3. assign the application group to receive
And then I try to run this competitor.
But, status complete error.
Help, please.
Thank you.
Hello
To save pl sql program, we have two required parameters. ERRBUFF and RETCODE
Steps to create a concurrent program of type PL/SQL stored procedure. Techmandate.com
No need to create these parameters in the simultaneous program window. Just use those in your procedure.
hope this will help you
-
Logic of tip insert - using a stored procedure?
Here's my use case:
- I have a table called TAGS that has two columns: id (number key, primary) and text (string)
- the table has a constraint of database set that each text must be unique
- the table also has a fixed sequence back next id available
- I created an entity of the DB object and its default View object
- I also created a page where I display a table read-only based on the View object
- Finally, I added a text field and a button to the page
- What I want to achieve is to insert all tags entered in the entry in the table fields, when the button is clicked. Note, however, that the entry field is a comma-separated list of tags, moreover, I have to insert only those tags that are new (to respect the constraint of database), and finally, I would like to use the sequence in insert or orders. Once completed, the page should also be updated.
My first question is whether a stored procedure is the right way to perform such a step insert logical. If not, what other means must be used in the ADF.
My second question is to know how to call the stored procedure and pass it the value of the input as a parameter field. I found this article http://andrejusb.blogspot.cz/2011/04/invoking-stored-procedures-and.html, but miss me a few transition points:
- How the callGreetingsFunction method call (I just get it that it's a method of the EO generated Java class?) after that the button is clicked?
- How to pass the value of the input field in this method as a parameter?
Thanks in advance for your help.
Now, what happens if I run it like this:
A. the procedure is executed after a click on the button
(B) the page is not updated (I had to do the research to get the new lines are visible in the table)
C. the constraint is ignored (after discounting there were several lines with unique identification number, but pr is - empty)
D. nothing has been committed to the database - if I closed the application window and it start again, the lines have disappeared from the table, but addition of new lines used number of increased seq
E. Similarly, if I did directly inserts into the database, these lines did not appear until I transferred the application
B. told it page to refresh. And that's usually enough to refresh your ViewObject with: viewObject.executeQuery)
C. Si the constraint is not enforced for null values. And this has nothing to do with the adf, this is related to oracle db.
D. you're calling commit.
E. you must re-run your view object (viewObject.executeQuery ())
Nevertheless, here is my rookie questions:
There there a simple way to refresh the page (or just the table containing the data)?
-How to validate changes (immediately after execution of the procedure)?
-How is the constraint has been ignored? I am sure it would fail on validation, but I thought that it will be considered even for adding data to the table.
-Are there a way to update the original Version of the database every time that the page is opened or refreshed?
-Drag and drop operation Execute like button on your page (or call vo.executeQuery () by program)
-Drag and drop the operation of posting as a button on your page (or invoke it by programming on the DBTransaction object)
-ignored for what values? for null values? It is expected, because each null is "unique."
-Yes, but you probably shouldn't do that for performance reasons, see this: Andrejus Baranovskis Blog: Cache results for ADF iterator property
Read also this: Andrejus Baranovskis Blog: job ADF and PL/SQL Invocation changes side effect
Dario
Maybe you are looking for
-
It is possible to capture and record a sequence of images with a LVDS OR 1422 EZMaker using Measurement & Automation Explorer? Everything is installed correctly and running and I am able to use the "Snap" command to save an image, as well as the 'Gr
-
Why my network time-out when you try to download the update for ipod?
I keep trying to download Ipod software version 5.0.1 which takes about 2 hours, but after an hour or two, says network error message has expired. I checked all the settings that I found but nothing helped.
-
It will never be a new Flight Simulator?
Microsoft will never do another Flight Simulator. I think FSX was a good match, but I think microsoft have the ability to create a more realistic and better game.
-
Just received this new HP instead HP 8600 8620. Former had some mechanical problems, as it will not load paper or stuck all the scans, well, it may be "just a wear and tear". Then, I installed the new HP 8620, connected instead of 8600 to the LAN via
-
Last week, on the advice of many, I upgraded from Business to ultimate so that I can work with video, etc. After a few hiccups, which worked well. Unfortunately the viewing of RAW images has evaporated. I have hundreds of images on external drives