Calling procedures from table and apex
Hi
I have a stored procedures and I want to put my stored procedures in table and I want to call store procedure from table in apex. how can I do this?
For example
I have stored procedures like Students(year number,birimno number)
GPA(birimno number,studentno number ) Student Procedure and GPA proecdure retrieve name and lastname
and I want to create a table
table has
Id Package Procedurename Arguments Header
1 GPA birimno, studentno name, lastname
2 Students year, birimno name,lastnameSo how can I do like this ? I want to call storeprocedures on APEX with selectlist. Selectlist will has a storeprocedures .
Edited by: esra aktas on 06.May.2011 01:48
Edited by: esra aktas on 06.May.2011 01:48
Edited by: esra aktas on 06.May.2011 04:08
I am beginner pl/sql .
I had searched execute immediate for helping my problem.
My purpose is that I want to collect all of procedures in one table. And I must retrived which I select procedure on APEX Selectlist.
So I started to create a table which name is procedures and I put my procedures names on it.
Now how can I execute to procedures that name is in table?
create or replace
procedure "ISINIF_BASARI"(normalyariyil number,birimno number )
IS
ogrenci_no VARCHAR2(12);
ders_kodu VARCHAR2(12);
ders_adi VARCHAR2(50);
harf_kodu VARCHAR2(4);
CURSOR c_basari IS
select dk.ogrenci_no,da.ders_kodu,da.ders_adi,dk.harf_kodu
into ogrenci_no,ders_kodu,ders_adi,harf_kodu
from ders_aktif da,ders_tanim dt, ders_kayit dk
where da.ders_kodu like birimno ||'%'
and (dt.normal_yariyili=normalyariyil
OR dt.normal_yariyili=normalyariyil+1)
and (da.acildigi_donem='1' or da.acildigi_donem='2')
and dt.ders_kodu = da.ders_kodu
and dk.acilan_ders_no = da.acilan_ders_no
BEGIN
FOR I IN c_basari LOOP
dbms_output.put_line(' OGRENCI NO '||I.OGRENCI_NO||' DERS KODU '|| I.DERS_KODU||' DERS ADI '||I.DERS_ADI||' HARF KODU '||I.HARF_KODU);
end loop;
end;I have procedure like that.
and I have a procedures table. And I put the procedure's name in table.
procedure
id procname
1 ISINIF_BASARI
Now I want to call procedure using this table .
When I call yhe procedures from table I wrote like this. But it has faults.
create or replace
PROCEDURE CALLSPFROMTABLE as
v_sql_exp VARCHAR2(100);
BEGIN
v_sql_exp :='begin'||'select p.procname from procedure p where id=1'||'end;';
end;Edited by: esra aktas on 07.May.2011 02:19
Similar Messages
-
Performance differce calling Procedure from sqlplus and Java
Hi ,
I have one procedure which is called from java application and its called only once from java and the entire process is running from procedure itself.Once its called there is no dependency from java to PL/SQL.Its taking long time from java.But if I execute the same procedure from SQL plus then its running in seconds.Also only one session is running in entire database.
My Oracle version 11g.
Please guide me if you get some thing based on below session event.
This is the session status for running from SQL plus
SID EVENT TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED WAIT_CLASS
2191 SQL*Net message from client 954 0 1319633 Idle
2191 direct path read 860 0 702 User I/O
2191 db file sequential read 2605 0 550 User I/O
2191 SQL*Net break/reset to client 24 0 460 Application
2191 SQL*Net more data from client 3 0 159 Network
2191 direct path write temp 214 0 74 User I/O
2191 direct path read temp 314 0 67 User I/O
2191 db file scattered read 78 0 42 User I/O
2191 db file parallel read 71 0 21 User I/O
2191 log file sync 36 0 12 Commit
2191 SQL*Net message to client 955 0 0 Network
2191 Disk file operations I/O 8 0 0 User I/O
2191 events in waitclass Other 15 7 0 Other
This is the session status for running from Java
SID EVENT TOTAL_WAITS TIME_WAITED WAIT_CLASS
1718 SQL*Net message from client 21208 7046039 Idle
1718 direct path read 2742 2327 User I/O
1718 log file sync 3748 1121 Commit
1718 db file sequential read 1533 1082 User I/O
1718 enq: TX - row lock contention 6 423 Application
1718 buffer busy waits 1 100 Concurrency
1718 log buffer space 1 30 Configuration
1718 direct path write temp 92 21 User I/O
1718 direct path read temp 138 16 User I/O
1718 log file switch (private strand flush incomplete) 6 16 Configuration
1718 SQL*Net message to client 21209 2 Network
1718 db file scattered read 2 1 User I/O
1718 SQL*Net more data from client 17 0 Network
1718 Disk file operations I/O 11 0 User I/O
1718 SQL*Net more data to client 1 0 Network
1718 events in waitclass Other 15 0 Other
Sorry I am not able to paste in proper alignment for my plain text.Hi,
you need to find which SQL is running slower, using some tools as dbms_profiler, dbms_hprof, ASH, extended SQL trace and real-time SQL monitor (caution: some of the tools may require Diagnostic Pack License).
Then you need to pinpoint difference in the plans and understand its origin -- post plans here if you need help with that (use tags to preserve formatting).
Best regards,
Nikolay -
Call procedure from table??
Hi
İ have a table which name is procedures and it has columns that id, procname. I have a procedures and them names are in table as procname. So I want to use table and execute procedures acoording to porcedure's id. I am trying execute immediate but ı couldnt .
create or replace
PROCEDURE Proc1(input varchar2) AS
BEGIN
dbms_output.put_line('welcome'||input);
END Proc1;table name is procedures
id 1
procname Proc1
create or replace
PROCEDURE CALLSPFROMTABLE(table_name IN VARCHAR2) as
proc varchar2(1000);
begin
execute immediate 'select procname from ' || table_name || where id=4 into proc;
dbms_output.put_line(proc);
END;Where is my fault ?
Edited by: esra aktas on 09.May.2011 12:33Is this what you are trying to do?
CREATE OR REPLACE PROCEDURE CALLSPFROMTABLE (table_name IN VARCHAR2)
AS
proc VARCHAR2 (1000);
l_sql VARCHAR2 (1000);
BEGIN
l_sql := 'select procname from ' || table_name || 'WHERE ID=4';
EXECUTE IMMEDIATE l_sql INTO proc;
l_sql := 'BEGIN ' || proc || '; ' || ' END;';
EXECUTE IMMEDIATE l_sql;
END;I dont recommend doing this. Redesing your process. Doesnt make sense for me. There are lot of other ways to achieve this. -
Fetch data from table and generate attachment than mail it.
Hello Experts,
From couple of day I am searching on Google for a better database procedure that will help me to get data from tables and generate attachment and mail it but i fail.
My Scenario is:
I have a query that will fetch almost 5000 records from database tables. Each record has almost 75 characters
select a.location_code,
a.item_code,
b.description item_desc,
to_char(a.manufact_date,'ddMonyy')mfg,
to_char((a.manufact_date + nvl(b.expiry_period,0)),'ddMonyy')expr,
to_char((a.manufact_date + nvl(b.qurantine_period,0)),'ddMonyy')qrtn,
round(nvl (b.qurantine_period, 0) - (sysdate - a.manufact_date)) days_elapsed,
a.closing_balance_posted quantity
from wms_stock_current_balance_v a, wms_item_setup_mast b
where a.closing_balance > 0
and a.item_code = b.item_code
and a.loc_type in ('RACKING','PICKING','QUICKA','BUNDLED')
and nvl(b.qurantine_period,0) > 0
and round(nvl (b.qurantine_period, 0) - (sysdate - a.manufact_date)) <= 0
order by a.item_code, a.location_code;
Sample data of above query is
LOCATION_CODE
ITEM_CODE
ITEM_DESC
MFG
Expiry
Quarantine
Days Elapse
Quantity
13DL2
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
14DL0
000000000000000F0487
CLEAR COOL BLACK 05ML
23-Feb-10
3-Apr-14
7-Jun-13
-119
134
14DL2
000000000000000F0487
CLEAR COOL BLACK 05ML
23-Feb-10
3-Apr-14
7-Jun-13
-119
160
14DR2
000000000000000F0487
CLEAR COOL BLACK 05ML
23-Feb-10
3-Apr-14
7-Jun-13
-119
20
14LL2
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
17ER2
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
17GL2
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
17SL0
000000000000000F0487
CLEAR COOL BLACK 05ML
17-Feb-10
28-Mar-14
1-Jun-13
-125
64
18QL0
000000000000000F0487
CLEAR COOL BLACK 05ML
23-Feb-10
3-Apr-14
7-Jun-13
-119
160
19AR5
000000000000000F0487
CLEAR COOL BLACK 05ML
17-Feb-10
28-Mar-14
1-Jun-13
-125
160
19DL1
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
19JR0
000000000000000F0487
CLEAR COOL BLACK 05ML
17-Feb-10
28-Mar-14
1-Jun-13
-125
60
19TL1
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
160
20GR2
000000000000000F0487
CLEAR COOL BLACK 05ML
20-Feb-10
31-Mar-14
4-Jun-13
-122
40
36FL3
000000000000000F0487
CLEAR COOL BLACK 05ML
18-Feb-10
29-Mar-14
2-Jun-13
-124
65
19UR0
000000000000000F0591
COMFORT WHITE 24ML*300
28-Oct-09
28-Oct-11
1-May-11
-887
1
12SL1
000000000000000F0593
COMFORT PINK 24ML*300
28-Oct-09
28-Oct-11
1-May-11
-887
42
12SR1
000000000000000F0593
COMFORT PINK 24ML*300
28-Oct-09
28-Oct-11
1-May-11
-887
42
14OR1
000000000000000F0593
COMFORT PINK 24ML*300
28-Oct-09
28-Oct-11
1-May-11
-887
8
36EL4
000000000000000F0594
CLEAR HF DECRASE 5M*360
14-Feb-10
14-Feb-11
12-Oct-10
-1088
14
13VL1
000000000000000F0595
CLEAR COM SFT CRE 5*360
8-Feb-10
8-Feb-11
6-Oct-10
-1094
160
14ER0
000000000000000F0595
CLEAR COM SFT CRE 5*360
8-Feb-10
8-Feb-11
6-Oct-10
-1094
105
Database Info
Oracle 10g
Version 10.2.0.1.0Look at the sample code for generating a CSV file that I've just posted in response to a similar question:
Re: How to execute a proc and spool files in a database job
And the use the search button in this forum to find sample code for sending a CLOB as a plain/text e-mail attachment using UTL_SMTP. -
Full Export/Import Errors with Queue tables and ApEx
I'm trying to take a full export of an existing database in order to build an identical copy in another database instance, but the import is failing each time and causing problems with queue tables and Apex tables.
I have used both the export utility and Data Pump (both with partial and full exports) and the same problems are occurring.
After import, queue tables in my schema are unstable. They cannot be dropped using the queue admin packages as they throw ORA-24002: QUEUE_TABLE <table> does not exist exceptions. Trying to drop the tables causes the ORA-24005: must use DBMS_AQADM.DROP_QUEUE_TABLE to drop queue tables error
As a result, the schema cannot be dropped at all unless manual data dictionary clean up steps (as per metalink) are done.
The Apex import fails when creating foreign keys to WWV_FLOW_FILE_OBJECTS$PART. It creates the table ok, but for some reason the characters after the $ are missing so the referencing tables try to refer to WWV_FLOW_FILE_OBJECTS$ only.
I am exporting from Enterprise Edition 10.2.0.1 and importing into Standard edition 10.2.0.1, but we are not using any of the features not available in standard, and I doubt this would cause the issues I'm getting.
Can anyone offer any advice on how I can resolve these problems so a full import will work reliably?Thanks for the lead!
After digging around MetaLink some more, it sounds like I'm running into Bug 5875568 (MetaLink Note:5875568.8) which is in fact related to the multibyte character set. The bug is fixed in the server patch set 10.2.0.4 or release 11.1.0.6. -
Is possible to call procedure from vorowimpl class
Hi,
please tell me how to call procedure from vorowimpl class.
Thanks in advance,
SANHi cruz,
Thanks for your reply.
I checked that link and they given for controller.
But i want to call that from the vorowimpl class. but i tried similar like calling in the controller.
here my code, please correct it if it is mistake.
public AssessmentsAMImpl xxam;
public String getXXCompName() {
//return (String) getAttributeInternal(XXCOMPNAME);
OADBTransaction txn=(OADBTransaction)xxam.getDBTransaction();
String compName=getCompName();
String xxName="";
CallableStatement cs=txn.createCallableStatement("DECLARE OUTPARAM VARCHAR2(100);begin apps.XX_COMP_ELEMENTSVO_PROC(:1,:2);end;",0);
try{
cs.setString(1,compName);
cs.registerOutParameter(2,OracleTypes.VARCHAR,0);
cs.execute();
xxName=cs.getString(1);
catch(Exception e){
try{
cs.close();
catch(Exception e){
return xxName;
} -
How to retrieve multiple data from table and represent it in jsp page
Hi
The below JavaScript code is used to add row in the table when I want to add multiple row data into table for single entry no field.
<html> function addRow()
i++;
var newRow = document.all("tblGrid").insertRow();
var oCell = newRow.insertCell();
oCell.innerHTML = "<input name='srno"+i+"' type='text' id='srno"+i+"' size=10>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='itmcd"+i+"' type='text' id='itmcd"+i+"' size='10'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='itmnm"+i+"' type='text' id='itmnm"+i+"' size='15'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='indentqty"+i+"' type='text' id='indentqty"+i+"' size='10'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='uom"+i+"' type='text' id='uom"+i+"' size='10'><input type='hidden' name='mcode"+i+"'id='mcode"+i+"'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='packqty"+i+"' type='text' id='packqty"+i+"' size='10'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='packuom"+i+"' type='text' id='packuom"+i+"' size='10'><input type='hidden' name='pack"+i+"' id='pack"+i+"'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='rate"+i+"' type='text' id='rate"+i+"' size='10'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='dor"+i+"' type='text' id='dor"+i+"' size='0' onClick='"+putdate(this.name)+"'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='bccode"+i+"' type='text' id='bccode"+i+"' size='10'></td><input type='hidden' name='bcc"+i+"' id='bcc"+i+"'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='cccode"+i+"' type='text' id='cccode"+i+"' size='10'></td><input type='hidden' name='ccc"+i+"' id='ccc"+i+"'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input name='remark2"+i+"' type='text' id='remark2"+i+"' size='20'>";
oCell = newRow.insertCell();
oCell.innerHTML = "<input type='button' value='Delete' onclick='removeRow(this);' />";
// oCell = newRow.insertCell();
// oCell.innerHTML = "<input type='button' value='Clear' onclick='clearRow(this);' />";
}<html> Then this data are send to the next Servlet for adding into two table.
My header portion data are added into one table which added only one row in table. while footer section data are added into the no of rows in another table dependent on No. of
Rows added into jsp page.
Here is an code for that logic.
<html>
ArrayList<String> mucode = new ArrayList<String>();
ArrayList<Integer> serials = new ArrayList<Integer>();
ArrayList<Integer> apxrate = new ArrayList<Integer>();
ArrayList<Integer> srname = new ArrayList<Integer>();
ArrayList<String> itcode = new ArrayList<String>();
ArrayList<String> itname = new ArrayList<String>();
ArrayList<Integer> iqnty = new ArrayList<Integer>();
ArrayList<String> iuom = new ArrayList<String>();
ArrayList<Integer> pqnty = new ArrayList<Integer>();
ArrayList<String> puom1 = new ArrayList<String>();
ArrayList<Integer> arate = new ArrayList<Integer>();
ArrayList<String> rdate = new ArrayList<String>();
ArrayList<String> bcs = new ArrayList<String>();
ArrayList<String> ccs = new ArrayList<String>();
ArrayList<String> remarkss = new ArrayList<String>();
//ArrayList<Integer> qtyrecs = new ArrayList<Integer>();
//ArrayList<String> dors = new ArrayList<String>();
//ArrayList<String> remarks = new ArrayList<String>();
String entryn = request.getParameter("entryno");
String rows = request.getParameter("rows");
out.println(rows);
//String Entryno = request.getParameter("entryno");
// out.println(Entryno);
int entryno = 0,reqqty = 0,srno = 0,deprequest = 0,rowcount = 0;
if(!Entryno.equals("")){
entryno = Integer.valueOf(Entryno);
if(!rows.equals("")){
rowcount = Integer.valueOf(rows);
for(int i=1;i<=rowcount;i++){
if(request.getParameter("srno"+i)!=null){
serials.add(Integer.valueOf(request.getParameter("srno"+i).trim()));
out.println(serials.size());
for(int i=1;i<=rowcount;i++){
if(request.getParameter("srno"+i)!=null){
srname.add(Integer.valueOf(request.getParameter("srno"+i).trim()));
out.println(srname.get(0));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("itmcd"+i)!=null){
itcode.add(request.getParameter("itmcd"+i).trim());
} //out.println(itcode.get(i));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("itmnm"+i)!=null){
itname.add(request.getParameter("itmnm"+i).trim());
}//out.println(itname.get(i));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("indentqty"+i)!=null){
iqnty.add(Integer.valueOf(request.getParameter("indentqty"+i).trim()));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("uom"+i)!=null){
iuom.add(request.getParameter("uom"+i).trim());
}//out.println(iuom.get(i));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("mcode"+i)!=null){
mucode.add(request.getParameter("mcode"+i).trim());
for(int i=1;i<=rowcount;i++){
if(request.getParameter("packqty"+i).equals("")){
pqnty.add(0);
}else
pqnty.add(Integer.valueOf(request.getParameter("packqty"+i).trim()));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("pack"+i)!=null){
puom1.add(request.getParameter("pack"+i).trim());
}else
puom1.add("");
for(int i=1;i<=rowcount;i++){
if(request.getParameter("rate"+i).equals("")){
arate.add(0);
}else
arate.add(Integer.valueOf(request.getParameter("rate"+i).trim()));
/* for(int i=1;i<=rowcount;i++){
if(request.getParameter("rate"+i)!=null){
arate.add(Integer.valueOf(request.getParameter("rate"+i).trim()));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("dor"+i)!=null){
try{
rdate.add(dashdate.format(slashdate.parse(request.getParameter("dor"+i).trim())));
}catch(ParseException p){p.printStackTrace();}
}else
{ rdate.add("");}
for(int i=1;i<=rowcount;i++){
if(request.getParameter("bcc"+i)!=null){
bcs.add(request.getParameter("bcc"+i).trim());
}out.println(bcs.get(0));
for(int i=1;i<=rowcount;i++){
if(request.getParameter("ccc"+i)!=null){
ccs.add(request.getParameter("ccc"+i).trim());
}out.println(ccs.get(0));
for(int i=1;i<=rowcount;i++){
out.println("remark2");
if(request.getParameter("remark2"+i)!=null){
remarkss.add(request.getParameter("remark2"+i).trim());
}out.println(remarkss.get(0));
ArrayList<String> Idate = new ArrayList<String>();
for(int i=1;i<=rowcount;i++){
if(request.getParameter("dateindent"+i)!=null){
try{
Idate.add(dashdate.format(dashdate.parse(request.getParameter("dateindent"+i).trim())));
}catch(ParseException p){p.printStackTrace();}
String Rdate = dashdate.format(new java.util.Date());
String tdate = dashdate.format(new java.util.Date());
// String Indentdate = dashdate.format(new java.util.Date());
// String ApprovedT1 = dashdate.format(new java.util.Date());
// String ApprovedT2 = dashdate.format(new java.util.Date());
// String ApprovedT1=" ";
//String ApprovedT2="";*/
String ApprovedT1= dashdate.format(new java.util.Date());
out.println (ApprovedT1);
String ApprovedT2=dashdate.format(new java.util.Date());
out.println(ApprovedT2);
String Indentdate=(dashdate.format(slashdate.parse(request.getParameter("dateindent").trim())));
out.println(Indentdate);
String Cocode ="BML001";
out.println(Cocode);
String Deptcode = request.getParameter("dept1");
out.println(Deptcode);
String Empcode = request.getParameter("emp");
out.println(Empcode);
String Refno =request.getParameter("rtype");
out.println(Refno);
String Divcode = request.getParameter("todiv1");
out.println(Divcode);
String Usercode = "CIRIUS";
String Whcode = request.getParameter("stor");
out.println(Whcode);
// String Itemgroupcode = request.getParameter("");
String Itemgroupcode ="120000";
out.println(Itemgroupcode);
String Supplytypecode = request.getParameter("stype");
out.println(Supplytypecode);
String Delcode = request.getParameter("deliverycode");
out.println(Delcode);
String Itemclass="WS";
out.println(Itemclass);
// String Itemclass = request.getParameter("iclass");
// out.println(Itemclass);
String unitcode = request.getParameter("uni");
out.println(unitcode);
String Todivcode = request.getParameter("todiv1");
out.println(Todivcode);
String Appxrate = request.getParameter("rate");
out.println(Appxrate);
String Srno = request.getParameter("srno");
out.println(Srno);
/* String Indqty = request.getParameter("indentqty");
out.println(Indqty);*/
String Itemcode = request.getParameter("itmcd");
out.println(Itemcode);
String Othersp = request.getParameter("remark1");
out.println(Othersp);
String Reqdt = request.getParameter("dor");
out.println(Reqdt);
String Munitcode = request.getParameter("mcode");
out.println(Munitcode);
String Packqty = request.getParameter("packqty");
out.println(Packqty);
String Packuom = request.getParameter("pack");
out.println(Packuom);
String Remark2 = request.getParameter("remark2");
out.println(Remark2);
String BC = request.getParameter("bcc");
out.println(BC);
String CC = request.getParameter("ccc");
out.println(CC);
try{
st=connection.createStatement();
connection.setAutoCommit(false);
String sql="INSERT INTO PTXNINDHDR(COCODE,DEPTCODE,EMPCODE,APPROVEDT1,APPROVEDT2,INDDT,ENTRYNO,REFNO,REMARKS,DIVCODE,USERCODE,WHCODE,ITEMGROUPCODE,SUPTYPECODE,DELCODE,UNITCODE,TODIVCODE,ITEMCLASS)VALUES('"+Cocode+"','"+Deptcode+"','"+Empcode+"','"+ApprovedT1+"','"+ApprovedT2+"','"+Indentdate+"',"+Entryno+",'"+Refno+"','"+Othersp+"','"+Divcode+"','"+Usercode+"','"+Whcode+"','"+Itemgroupcode+"','"+Supplytypecode+"','"+Delcode+"','"+unitcode+"','"+Todivcode+"','"+Itemclass+"')";
out.println(sql);
st.addBatch(sql);
for(int i=0;i<serials.size();i++){
out.println("Inside the Statement");
String query3="test query for u";
out.println(query3);
String queryx="Insert into PTXNINDDTL(APXRATE,ENTRYNO,BRKNO,INDQTY,ITEMCODE,OTHERSPFCS,MUNITCODE,PACKQTY,PACKUOM,REMARKS,DIMSUBGRPCODE,DIMCODE,REQDT)VALUES("+arate.get(i)+","+entryno+","+srname.get(i)+","+iqnty.get(i)+","+itcode.get(i)+",'"+Othersp+"','"+mucode.get(i)+"',"+pqnty.get(i)+",'"+puom1.get(i)+"','"+remarkss.get(i)+"','"+bcs.get(i)+"','"+ccs.get(i)+"','"+rdate.get(i)+"')";
out.println(queryx);
st.addBatch(queryx);
int[] result=st.executeBatch();
connection.commit();
for(int k=0;k<result.length;k++)
out.println("rows updated by "+(k+1)+"insert sta:"+result[k]+"");
catch(BatchUpdateException bue)
out.println("error1;"+bue+"");
catch(SQLException sql)
out.println("error2;"+sql+"");
catch(Exception l)
out.println("error3;"+l+"");
</html>
Now I looking for to retrieve this footer section data available in multiple rows from footer table and present it in jsp page .
I am finding difficulties in how to show this multiple row data for dynamic no of rows .i.e. variable no. of rows.
I have able to show the data in Header portions of page in this ways
here i am adding the part of code which shows the data from header part of table i.e from Header table
<html>
<h2 align="center"><b>Indent Preparation</b></h2>
<div align="left">
<table width="849" border="0" cellspacing="3" cellpadding="3" align="center">
<tr>
<td ><div align="left"><b>Indent No.</b></div></td>
<td ><label>
<input name="indentno" type="text" id="indentno" size="15" value="" /><input type="hidden" name="no" id="no">
</label></td>
<td ><div align="center"><strong>Indent Date</strong></div></td>
<td ><label>
<div align="center">
<input name="dateindent" type="text" id="dateindent"value="<%=date1%>"/><input type="hidden" name="no" id="no">
</div>
</label></td>
<td> </td>
<td><div align="right"><strong>Entry No.</strong></div></td>
<%if(oper!=null && oper.equals("view") && hdrcode!=null && hdrdetails!=null){%>
<td><input type="text" value="<%=hdrcode.get(3)%>" size="10"></td>
<%}else{%>
<td><input type="text" name="entryno" id="entryno" value="<%=entryNo%>"/></td>
<%}%>
<div align="right"></div>
</tr>
<tr>
<td><b>Division</b></td>
<%if(oper!=null && oper.equals("view") && hdrcode!=null && hdrdetails!=null){%>
<td><input type="text" value="<%=hdrdetails.get(9)%>" size="20"</td>
<td><input type="hidden" name="div1" id="div1" value='<%=hdrcode.get(10)%>'></td>
<%}else{%>
<td><input type="text" name="div" id="div" /></td>
<td><input type="hidden" name="div1" id="div1" /> </td>
<%}%>
<td> </td>
<td> </td>
<td><div align="right"><strong>Unit</strong></div></td>
<%if(oper!=null && oper.equals("view") && hdrcode!=null && hdrdetails!=null){%>
<td><input type="text" value="<%=hdrdetails.get(14)%>" size="20"</td>
<td><input type="hidden" name="uni" id="uni" value='<%=hdrcode.get(12)%>'></td>
<%}else{%>
<td><input type="text" name="unit" id="unit" /></td>
<td><input type="hidden" name="uni" id="uni" /> </td>
<%}%>
</tr>
<tr>
</html>
Any suggestion on any above works is highly appreciated.
Thanks and regards
harshalToo much code. It's also not well intented nor formatted. I don't see a question either or it got lost in that heap of unformatted code.
I will only answer the question in the thread's subject:
How to retrieve multiple data from table and represent it in jsp pageTo retrieve, make use of HttpServletRequest#getParameterValues() and/or #getParameter().
To display, make use of JSTL's c:forEach. -
WebDynpro Java: how to remove blank element from Table and Dropdown.
Hi Folks
In a webdynpro application,
I created a table and witten the below code to populate the table
IPrivateDummyView.IFirst_TableElement First_Table_Element = null;
First_Table_Element = wdContext.nodeFirst_Table().createFirst_TableElement();
First_Table_Element.setF_Value("One");
wdContext.nodeFirst_Table().addElement(First_Table_Element);
First_Table_Element = wdContext.nodeFirst_Table().createFirst_TableElement();
First_Table_Element.setF_Value("2");
wdContext.nodeFirst_Table().addElement(First_Table_Element);
As per the code, i got 2 row in the table.
But , i have one Empty row on top of the table , how to get ride of this.
i find the same problem happening with dropdown too, where i used DDBI, i populated a the content as mention, but i initial 2 row as blank and then i have my own elements ,as per my code.>
> how to remove blank element from Table and Dropdown
>
Change selection property of related node to from 0..1 to 1..1 (mandatory)
Re: DropdownByIndex and empty line (Thread: DropdownByIndex and empty line )
Re: Can the empty selection be removed from element dropdownbykey(Thread: Can the empty selection be removed from element dropdownbykey )
Edited by: Anagha Jawalekar on Nov 18, 2008 10:28 PM -
WD Mycloud 4TB fell down from table and hearing click sound
WD Mycloud 4TB fell down from table and hearing click sound for few times and hearing no sound, Please help me on how to recover my data from this drive? I see red light come up after a while.
Sounds like the drive has been damaged if your hearing a clicking noise from the hard drive. If you have an ongoing SafePoint backup you should be able to access the last SafePoint backup to recover or access the files that were last backed up from the WD My Cloud. If the drive is no longer accessible after doing a soft reset (press and hold the reset button for 4 seconds) or a system reset (press and hold the reset button for 40 seconds) then chances are high the drive is either damaged or the unit is bricked. You have two basic options but there may be others.Contact WD and enquire about data recovery and warranty repair/replacement of the possibly damaged drive.Void the warranty and remove the drive from the WD My Cloud enclosure connect it to a computer (like through an external SATA enclosure/docking station or via a desktop PC) and use a Linux boot disk distro or a Linux OS (possibly even a Mac) to access the hard drive and possibly its contents.On a side note same thing happened to a family member. Thier WD My Cloud got knocked off a shelf onto a stone floor and damaged the hard drive. The impact was hard enough to knock the white cover off the WD My Cloud. Drive was pulled but was erratically recognised by Linux and the data was non recoverable (with the tools I had on hand) from the drive. Took a spare unused SATA drive and followed one fo the various threads (like this one or this one) on recovering a bricked or replacing the hard drive on a WD My Cloud and had the WD My Cloud back up and running some time later. The work around in the future is to use the SafePoint feature of the WD My Cloud user interface to backup the WD My Cloud to another hard drive like an attached USB drive. that way you provide some data redundancy in the case of the WD My Cloud hard drive becoming unreadable/unusable.
-
Unique problem, can get calls only from Airtel and...
Hi Friends, I have a unique problem here and some input on the same.
I can receive incomming calls only from Airtel and no other service providers. I do not know why. I cannot even recieve calls from landline and also cannot get other providers SMSes.
Please help me out in this regard.
I am using Nokia E72 handsetYou may want to check your firewall settings. Go to options-security-firewall. Check to see if it is enabled and the scroll down to exceptions and see if any of those are selected.
-
Calling Overloaded Procedures from Table Adapter - PLS-00307: too many..
I have called Overloaded Oracle Procs in .NET code in the past. I now want to add a procedure call to a table adapter. The proc is an overloaded proc and when I add it I get the following:
PLS-00307: too many declarations of 'prc_[my proc name]' match this call.
I looked in the designer class and all the parameters are there, just as I do in my own code, but it still gets the message above even with all the parameter names in place.
Is there a way to call Overloaded Procs from a table adapter? ?Any Oracle folks care to provide some input on why Table Adapters cannot call Overloaded Stored Procs?
Edited by: SURFThru on Jul 8, 2011 11:37 AM -
I am trying to call a procedure from a button that will work out the total of an order and display it in the total field in my master block.
I am unsure as to how to call the prodcedure from my button. I have written the procedure in the PL/SQL Stored Program Units part like it says in the help file but am now stuck.
I assume I use a WHEN-BUTTON-PRESSED trigger but what do I write in the trigger?What about placing outputs from the procedure to fields on the form?
Here is the procedure I have created:
procedure vatTotal (Order_no IN number,Total2 OUT number)
AS
CURSOR c_vatTotal is
select order_line.quantity, gre_product.cost from ord, gre_product, order_line where ord.order_no = order_line.order_no AND
gre_product.prod_no = order_line.Product_no;
Total number;
begin
Total:= 0;
for c_record in c_vatTotal loop
Total := Total + c_record.quantity * c_record.cost;
end loop;
Total2 := Total;
end;
I believe this is correct. It compiles.
I tried using Total as an out parameter but received the "duplicate fields in RECORD, TABLE or argument list are not permitted" error. -
How to Call Procedure from Trigger body?
I have a procedure that works which I tested from sqlplus with 'exec proc_name;'
what I want is to call this procedure from the trigger and pass the parameters to the proc. the trigger fires AFTER INSERT of certain table and I want to pass those just added attribute values to the proc.
please help.
I have tried to do 'exec proc_name' from the trigger but it does not work?You don't use exec within pl/sql, just proc_name followed by your parmateters. From within a trigger, the just added values will be :new.column_name. So, you would have something like:
CREATE OR REPLACE TRIGGER your_trigger_name
AFTER INSERT ON your_table_name
FOR EACH ROW
BEGIN
proc_name (:NEW.column_name1, :NEW.column_name2);
END your_trigger_name;
/You will need to have corresponding input parameters in your proc_name procedure, something like:
CREATE OR REPLACE PROCEDURE proc_name
(p_column_name1 your_table_name.column_name1%TYPE,
p_column_name2 your_table_name.column_name2%TYPE)
AS
BEGIN
-- whatever processing you want to do
END proc_name; -
How to call procedure from OCI ?
How to call oracle procedure from OCI ?
Following works on Windows, your mileage may vary. IIRC one of the standard OCI examples that install with the libraries demonstrates this too.
/* SQL to create table and Stored Procedures */
Create table OCI8StoredProcedureSampleTable
(field1 number(5), field2 varchar2(30));
CREATE OR REPLACE PROCEDURE OCI8StoredProcedureSample3
(field1 number, field2 IN OUT varchar2)
is
begin
insert into OCI8StoredProcedureSampleTable values (field1, field2);
Commit;
field2 := 'Successful';
end;
CREATE OR REPLACE PROCEDURE OCI8StoredProcedureSample4
(field1 number, field2 char, field3 OUT varchar2)
is
begin
insert into OCI8StoredProcedureSampleTable values (field1, field2);
Commit;
field3 := 'Successful';
end;
CREATE OR REPLACE FUNCTION OCI8StoredProcedureSample5
RETURN VARCHAR2
is
v_Sysdate DATE;
v_charSysdate VARCHAR2(20);
begin
SELECT TO_CHAR(SYSDATE, 'dd-mon-yyyy') into v_charSysdate FROM DUAL;
return(v_charSysdate);
end;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <oci.h>
static void checkerr (OCIError *p_err, sword status);
void main()
OCIEnv *p_env;
OCIError *p_err;
OCISvcCtx *p_svc;
OCIStmt *p_sql;
OCIBind p_Bind1 = (OCIBind ) 0;
OCIBind p_Bind2 = (OCIBind ) 0;
OCIBind p_Bind3 = (OCIBind ) 0;
OCIDefine p_define1 = (OCIDefine ) 0;
char field2[20] = "Entry 3";
char *field3;
//char field3[20];
sword field1 = 3;
text mySql = (text ) "Begin OCI8StoredProcedureSample3(:field1, :field2); END;";
printf("OCIInitialize\n");
checkerr(p_err, OCIInitialize((ub4) OCI_OBJECT,
(dvoid *) 0, (dvoid * (*) ()) 0,
(dvoid * (*) ()) 0, (void (*) ()) 0));
printf("OCIEnvInit\n");
checkerr(p_err, OCIEnvInit(&p_env, (ub4) OCI_DEFAULT,
(size_t) 0, (dvoid **)0));
printf("OCIHandleAlloc\n");
checkerr(p_err, OCIHandleAlloc(p_env, &p_err, OCI_HTYPE_ERROR,
(size_t) 0, (dvoid **) 0));
printf("OCIHandleAlloc\n");
checkerr(p_err, OCIHandleAlloc(p_env, &p_svc, OCI_HTYPE_SVCCTX,
(size_t) 0, (dvoid **) 0));
printf("OCIHandleAlloc\n");
checkerr(p_err, OCIHandleAlloc(p_env, &p_sql, OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));
printf("OCILogon\n\n");
checkerr(p_err, OCILogon(p_env, p_err, &p_svc, "SCOTT", 5, "TIGER", 5, "V8", 2));
/* Example 1 - Using an IN OUT Parameters */
printf("*************************************************\n");
printf("Example 1 - Using an IN OUT Parameters\n");
printf("*************************************************\n");
printf(" OCIStmtPrepare\n");
printf(" %s\n",mySql);
checkerr(p_err, OCIStmtPrepare(p_sql, p_err, mySql,
(ub4) strlen(mySql), OCI_NTV_SYNTAX, OCI_DEFAULT));
printf(" OCIBindByPos 1\n");
checkerr(p_err, OCIBindByPos(p_sql, &p_Bind1, p_err, 1, (dvoid *) &field1, sizeof(sword),
SQLT_INT, 0, 0, 0, 0, 0, OCI_DEFAULT));
printf(" OCIBindByPos 2\n");
checkerr(p_err, OCIBindByPos(p_sql, &p_Bind2, p_err, 2, field2, (sizeof(field2) - 1),
SQLT_CHR, 0, 0, 0, 0, 0, OCI_DEFAULT));
printf(" Field2 Before:\n");
printf(" size ---> %d\n", sizeof(field2));
printf(" length ---> %d\n", strlen(field2));
printf(" value ---> %s\n", field2);
printf(" OCIStmtExecute\n");
checkerr(p_err, OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0, (OCISnapshot *)
NULL, (OCISnapshot *) NULL, (ub4) OCI_COMMIT_ON_SUCCESS));
printf(" Field2 After:\n");
printf(" size ---> %d\n", sizeof(field2));
printf(" length ---> %d\n", strlen(field2));
printf(" value ---> %s\n", field2);
/* Example 2 - Using OUT Parameters */
field1 = 4;
strcpy(field2, "Entry 4");
printf("\n\n*************************************************\n");
printf("Example 2 - Using OUT Parameters\n");
printf("*************************************************\n");
printf(" OCIStmtPrepare\n");
strcpy(mySql,(text *) "Begin OCI8StoredProcedureSample4(:field1, :field2, :field3); END;");
printf(" %s\n",mySql);
checkerr(p_err, OCIStmtPrepare(p_sql, p_err, mySql,
(ub4) strlen(mySql), OCI_NTV_SYNTAX, OCI_DEFAULT));
printf(" OCIBindByPos 1\n");
checkerr(p_err, OCIBindByPos(p_sql, &p_Bind1, p_err, 1, (dvoid *) &field1, sizeof(sword),
SQLT_INT, 0, 0, 0, 0, 0, OCI_DEFAULT));
printf(" OCIBindByPos 2\n");
checkerr(p_err, OCIBindByPos(p_sql, &p_Bind2, p_err, 2, field2, strlen(field2),
SQLT_CHR, 0, 0, 0, 0, 0, OCI_DEFAULT));
printf(" OCIBindByPos 3\n");
checkerr(p_err, OCIBindByPos(p_sql, &p_Bind3, p_err, 3, field3, 19,
SQLT_CHR, 0, 0, 0, 0, 0, OCI_DEFAULT));
printf(" OCIStmtExecute\n");
checkerr(p_err, OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0, (OCISnapshot *)
NULL, (OCISnapshot *) NULL, (ub4) OCI_COMMIT_ON_SUCCESS));
printf(" Field3 After:\n");
printf(" size ---> %d\n", sizeof(field3));
printf(" length ---> %d\n", strlen(field3));
printf(" value ---> %s\n", field3);
/* Example 3 - Using a Function to Return a Value */
printf("\n\n*************************************************\n");
printf("Example 3 - Using a Function to Return a Value \n");
printf("*************************************************\n");
printf(" OCIStmtPrepare\n");
strcpy(mySql,(text *) "SELECT OCI8StoredProcedureSample5 from DUAL");
printf(" %s\n",mySql);
checkerr(p_err, OCIStmtPrepare(p_sql, p_err, mySql,
(ub4) strlen(mySql), OCI_NTV_SYNTAX, OCI_DEFAULT));
checkerr(p_err, OCIDefineByPos(p_sql, &p_define1, p_err, 1, (dvoid *) field3,
(sword) 20, SQLT_STR, (dvoid *) 0, (ub2 *)0, (ub2 *)0, OCI_DEFAULT));
printf(" OCIStmtExecute\n");
checkerr(p_err, OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0, (OCISnapshot *)
NULL, (OCISnapshot *) NULL, (ub4) OCI_COMMIT_ON_SUCCESS));
printf(" The return value:\n");
printf(" size ---> %d\n", sizeof(field3));
printf(" length ---> %d\n", strlen(field3));
printf(" value ---> %s\n", field3);
return;
static void checkerr(errhp, status)
OCIError *errhp;sword status;
text errbuf[512];
ub4 errcode;
switch (status)
case OCI_SUCCESS:
break;
case OCI_SUCCESS_WITH_INFO:
printf("Error - OCI_SUCCESS_WITH_INFO\n");
break;
case OCI_NEED_DATA:
printf("Error - OCI_NEED_DATA\n");
break;
case OCI_NO_DATA:
printf("Error - OCI_NO_DATA\n");
break;
case OCI_ERROR:
OCIErrorGet ((dvoid *) errhp, (ub4) 1, (text *) NULL, &errcode,
errbuf, (ub4) sizeof(errbuf), (ub4) OCI_HTYPE_ERROR);
printf("Error - %s\n", errbuf);
break;
case OCI_INVALID_HANDLE:
printf("Error - OCI_INVALID_HANDLE\n");
break;
case OCI_STILL_EXECUTING:
printf("Error - OCI_STILL_EXECUTE\n");
break;
case OCI_CONTINUE:
printf("Error - OCI_CONTINUE\n");
break;
default:
break; -
Call procedure from form which displays HTML
I have a form based on a table with three columns. When I press the insert button, I want to insert the data into the table and then pass the data to a procedure (wihtin a package), which will call an external java procedure and get a passcode returned to it. I then need to display the passcode to the user's screen (which I am currently attempting to do via htp/htf calls within a procedure in the package).
I tried to put the call to the package in a trigger. It succeeded in calling the external procedure, but did not display anything to the browser afterwords.
I then tried to put the call to the PL/SQL code on my Insert button. I have tried various flavors of this call, but here is the current version:
declare
v_user_key_id lcams_db.user_token_link.user_key_id%TYPE;
v_tkn_ser_no lcams_db.user_token_link.tkn_ser_no%TYPE;
v_actv_ind lcams_db.user_token_link.utl_actv_ind%TYPE;
blk varchar2(10):='DEFAULT';
begin
v_user_key_id:=p_session.get_value_as_number(
p_block_name=>blk, p_attribute_name=>'A_USER_KEY_ID');
v_tkn_ser_no:=p_session.get_value_as_varchar2(
p_block_name=>blk, p_attribute_name=>'A_TKN_SER_NO');
v_actv_ind:=p_session.get_value_as_varchar2(
p_block_name=>blk, p_attribute_name=>'A_UTL_ACTV_IND');
lcams_db.otp.set_otp_user_key_id(v_user_key_id);
lcams_db.otp.set_otp_tkn_ser_no(v_tkn_ser_no);
lcams_db.otp.set_otp_actv_ind(v_actv_ind);
doInsert;--- This is the default handler
lcams_db.otp.otp_utl('INSERTING');
end;
otp is the package. I have three variables in my package otp_user_key_id, otp_tkn_ser_no, and otp_actv_ind which I pull from session storage and put into the package variables. the otp_utl sets a variable and calls otp_add_user, which gets more data from the table and calls the pl/sql wrapper for the java routine to actually add the user into the external OTP database. The java routine returns the status and initial passcode and then I call a routine internal to the package to display the results to the user via htp and htf calls.
The best result was getting the table to update and the external database to update, but I never got the resulting html to diplay. With the current code, the browser goes away with a message of Connecting to... and nothing gets updated and my browser eventually comes back with a 'No data...' message.
Is there a way to do what I want? Ideally I would like to call the package, display the results, and provide a back link so the user can get back to the original form after the user has read the passcode message.
nullOkay. I put the following code in the 'On successful submission of the form...'
section of the form and I tinkered with it until it works; however, it currently assumes
the Insert button was the button clicked.
declare
v_user_key_id lcams_db.user_token_link.user_key_id%TYPE;
v_tkn_ser_no lcams_db.user_token_link.tkn_ser_no%TYPE;
v_actv_ind lcams_db.user_token_link.utl_actv_ind%TYPE;
blk varchar2(10):='DEFAULT';
my_url VARCHAR2(200);
return_url VARCHAR2(200);
begin
v_user_key_id:=p_session.get_value_as_number(
p_block_name=>blk, p_attribute_name=>'A_USER_KEY_ID');
v_tkn_ser_no:=p_session.get_value_as_varchar2(
p_block_name=>blk, p_attribute_name=>'A_TKN_SER_NO');
v_actv_ind:=p_session.get_value_as_varchar2(
p_block_name=>blk, p_attribute_name=>'A_UTL_ACTV_IND');
my_url := 'lcams_db.otp.otp_utl?' | |
'p_user_key_id=' | | TO_CHAR(v_user_key_id) | |
'&p_tkn_ser_no=' | | v_tkn_ser_no | |
'&p_actv_ind=' | | v_actv_ind;
call(my_url,return_url);
end;
How do I determine which button was clicked for the 'On successful submission...' section so I can call the correct routine?
null
Maybe you are looking for
-
"Would you like to install a Java SE 6 runtime now?" NO!!!
Every 30 minutes or so, the message, To open "java," you need a Java SE 6 runtime. Would you like to install one now? pops on my screen no matter what software I am using. I disabled anything Java in my web browsers, looking at the log in the Console
-
How do i see what's on my shuffle using itunes
why is there no method to see what's stored on the shuffle through itunes. That seems like a pretty common action.
-
Hello, Pie chart is not displayed when I tried this sql with 'order by' clause. select null, b.subject_name, count(a.subject) cnt from schooltemp a, subject b where a.subject = b.subject_id group by b.subject_name order by cnt desc This sql works onl
-
GR with reference to Delivery Order
Hi How to GR with reference to the Outbound Delivery order ? Possible to do in MIGO ? My Current setting allows GR with ref to Mat.Doc/P.O/Prod.Order/Other. Thanks RG
-
Copy all the objects from the one system that start with (ZANK)
hi to all, I have installed the name space /ank/ in the US system, we need to copy all the objects from the India system that start with (Zank) and re-create them as /ank/. problem is how can i copy objects and re-create. thanks