T.CODE SEARCH FROM TABLE
Hii,
In our company, we are going to do the acrhiving projject,so in second phase we have to find out t.code which using th4e database,ex.EA60 used table ERDK,
We have alomst 110 tables,
we have idetified the below process,
1.take program of each t.code and then search to it,but it lenghty process ,
pls let me know any other porcess
Hi,
follow the steps for archiving steps below for archiving take help form technical guy to create physical file and path
*AOBJ* : SELECT ARCHEVING OBJECT FORM THE SAP DEFINED TABLE
USE T.CODE FILE:FOR LOGICAL FILE PATH DEFINATION
ASSIGN THE PHYSICAL PATH TO THE FILE
USE T.CODE SARA TO ARCHIVING JOB
Hope it helps you
Warm Regards
surya pamarty
Similar Messages
-
i have attached the code with table having a field of Empid.
how to give a link from Empid field to generate Empname,Depname
in a table format.
<html>
<head>
<title>Masterreport.jsp</title>
</head>
<body>
<%
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(ClassNotFoundException excep)
System.out.println("exception caught"+excep.getMessage());
java.sql.Connection con=java.sql.DriverManager.getConnection("jdbc:odbc:Visualcaccess");
java.sql.Statement st=con.createStatement();
java.sql.ResultSet rs=null;
try
String string="select Empno from Employe" ;
rs=st.executeQuery(string);
}catch(Exception e)
out.write("Exception caught"+e.getMessage());
%>
<TABLE border="1" cellpadding="5">
<TBODY>
<TR>
<TH colspan="1"><U>Updated List ofEmployees</U></TH>
</TR>
<TR>
<TH>Emp Name</TH>
</TR>
<% while(rs.next()){ %>
<TR>
<TD><%=rs.getInt(1)%></TD></A>
</TR>
<%}
rs.close();
st.close();
con.close();
%>
</TBODY>
</TABLE>
</form>
</body>
</html>Example from jsp document. Modify this to suit your needs. hope this helps.
<%
while (RS.next()){
id = RS.getInt("id");%>
<a href="cp5.jsp?id=<%=id%>">voting</a>
<%
%>
then
int id = Integer.parseInt(request.getParameter("id"));
String empname = "";
String depname = "";
SELECT * FROM TABLE WHERE id=id;
<%
if (RS.next()){
empname = RS.getString("empname");
depname = RS.getString("depname");
%>
<tr>
<td>
<%=empname%><%=depname%>
</td>
</tr>
<%
%> -
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. -
Here is my situation. I have a table that has a list of codes almost 100K. I have another table that has code listed in term of an in house regular expression.
Example:
40a.[1,2,3]
12b
Where
a is 0 - 9
b is 1 - 9
I have tried using REGEXP_LIKE but I get ORA-04030: out of process memory error.
My question is there a way to do this search such that it will be fast and efficient.
I have through about expanding the Expressed code, but that could lead to a lot of codes, and it specially gets tricky if the code is in the format of "1a2b". In this case I would need to somehow create 90 (10*9) rows. I am not entriely sure how to do this dynamically, because there could be a lot of variations.
The current approcach I am thinking of is to search based on character placement. Such that each character becomes a column and I do the comparisson as
Base_Char_1 = Code_Exp_1
Base_Char_2 = Code_Exp_2
I have not figured out how this would work. Shown below is the REGEXP_LIKE approach. Any help or advice would be great.
WITH t1 AS
(SELECT '40a.[0,1,9]1' AS code_exp
FROM DUAL
), t2 AS
(SELECT code_exp
, '^' || REPLACE (REPLACE (REPLACE (REPLACE (code_exp, 'a', '[0-9]'), '.', '\.'), 'b', '[1-9]'), ',') || '$' AS code_regexp
FROM t1)
SELECT *
FROM t2
WHERE REGEXP_LIKE ('402.11', code_regexp)Thanks.Well, it is probably a design issue - joining 100 000 codes with 10 000 regular expressions based on regexp_like() will effectively mean 1e9 calculated regular expressions, which means a lot of work i suppose.
Besides that, there is indeed something strange on pga/uga memory consumption when regular expressions are stored in the table. I've set up small test case based on your data
SQL> CREATE TABLE codes AS
2 SELECT dbms_random.string('p',10) code
3 FROM dual
4 CONNECT BY LEVEL <=100000
5 UNION ALL
6 SELECT '402.11' FROM dual
7 /
Table created.
SQL> CREATE TABLE code_expressions AS
2 WITH t1 AS
3 (SELECT '40a.[0,1,9]1' AS code_exp
4 FROM DUAL
5 ), t2 AS
6 (SELECT code_exp, '^' ||
7 REPLACE (REPLACE (REPLACE (REPLACE (code_exp, 'a', '[0-9]'), '.', '\.'), 'b', '[1-9]'), ',')
8 || '$' AS code_regexp
9 FROM t1)
10 SELECT * FROM t2
11 /
Table created.
SQL> exec dbms_stats.gather_table_stats(user,'codes')
PL/SQL procedure successfully completed.
SQL> exec dbms_stats.gather_table_stats(user,'code_expressions')
PL/SQL procedure successfully completed.
SQL> set lines 100
SQL> col code for a15
SQL> col code_exp for a15
SQL> col code_regexp for a25
SQL> exec runStats_pkg.rs_start;
PL/SQL procedure successfully completed.
SQL> SELECT * FROM codes,code_expressions WHERE regexp_like(code,'^40[0-9]\.[019]1$');
CODE CODE_EXP CODE_REGEXP
402.11 40a.[0,1,9]1 ^40[0-9]\.[019]1$
SQL> exec runStats_pkg.rs_middle;
PL/SQL procedure successfully completed.
SQL> SELECT * FROM codes,code_expressions WHERE regexp_like(code,code_regexp);
CODE CODE_EXP CODE_REGEXP
402.11 40a.[0,1,9]1 ^40[0-9]\.[019]1$
SQL> exec runStats_pkg.rs_stop;
Run1 ran in 34 hsecs
Run2 ran in 276 hsecs
run 1 ran in 12.32% of the time
Name Run1 Run2 Diff
STAT...session cursor cache co 1 0 -1
.... sniped
STAT...CPU used when call star 37 276 239
STAT...CPU used by this sessio 37 276 239
STAT...DB time 37 277 240
STAT...Elapsed Time 36 283 247
STAT...session pga memory 65,536 0 -65,536
STAT...session uga memory 65,560 0 -65,560
STAT...session pga memory max 262,144 10,551,296 10,289,152
STAT...session uga memory max 261,964 10,592,024 10,330,060
Run1 latches total versus runs -- difference and pct
Run1 Run2 Diff Pct
1,009 1,348 339 74.85%
PL/SQL procedure successfully completed.
SQL>
SQL> conn scott/tiger
Connected.
SQL> set lines 100
SQL> col code for a15
SQL> col code_exp for a15
SQL> col code_regexp for a25
SQL>
SQL> exec runStats_pkg.rs_start;
PL/SQL procedure successfully completed.
SQL> SELECT * FROM codes,code_expressions WHERE regexp_like(code,'^40[0-9]\.[019]1$');
CODE CODE_EXP CODE_REGEXP
402.11 40a.[0,1,9]1 ^40[0-9]\.[019]1$
SQL> exec runStats_pkg.rs_middle;
PL/SQL procedure successfully completed.
SQL> SELECT * FROM codes,code_expressions
2 WHERE regexp_like(code,'^' ||
3 REPLACE (REPLACE (REPLACE (REPLACE (code_exp, 'a', '[0-9]'), '.', '\.'), 'b', '[1-9]'), ',') ||
4 '$');
CODE CODE_EXP CODE_REGEXP
402.11 40a.[0,1,9]1 ^40[0-9]\.[019]1$
SQL> exec runStats_pkg.rs_stop;
Run1 ran in 37 hsecs
Run2 ran in 335 hsecs
run 1 ran in 11.04% of the time
Name Run1 Run2 Diff
STAT...recursive cpu usage 3 2 -1
.... sniped
STAT...CPU used when call star 40 336 296
STAT...CPU used by this sessio 40 336 296
STAT...DB time 40 336 296
STAT...Elapsed Time 39 338 299
STAT...session pga memory 65,536 0 -65,536
STAT...session uga memory 65,560 0 -65,560
STAT...session pga memory max 262,144 10,551,296 10,289,152
STAT...session uga memory max 261,964 10,592,024 10,330,060
Run1 latches total versus runs -- difference and pct
Run1 Run2 Diff Pct
1,022 1,348 326 75.82%
PL/SQL procedure successfully completed.
SQL> explain plan for
2 SELECT * FROM codes,code_expressions WHERE regexp_like(code,'^40[0-9]\.[019]1$');
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 1698472622
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5000 | 205K| 59 (6)| 00:00:01 |
| 1 | MERGE JOIN CARTESIAN| | 5000 | 205K| 59 (6)| 00:00:01 |
| 2 | TABLE ACCESS FULL | CODE_EXPRESSIONS | 1 | 31 | 3 (0)| 00:00:01 |
| 3 | BUFFER SORT | | 5000 | 55000 | 56 (6)| 00:00:01 |
|* 4 | TABLE ACCESS FULL | CODES | 5000 | 55000 | 56 (6)| 00:00:01 |
Predicate Information (identified by operation id):
4 - filter( REGEXP_LIKE ("CODE",'^40[0-9]\.[019]1$'))
16 rows selected.
SQL> explain plan for
2 SELECT * FROM codes,code_expressions WHERE regexp_like(code,code_regexp);
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3098457583
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5000 | 205K| 57 (2)| 00:00:01 |
| 1 | NESTED LOOPS | | 5000 | 205K| 57 (2)| 00:00:01 |
| 2 | TABLE ACCESS FULL| CODE_EXPRESSIONS | 1 | 31 | 3 (0)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| CODES | 5000 | 55000 | 54 (2)| 00:00:01 |
Predicate Information (identified by operation id):
3 - filter( REGEXP_LIKE ("CODE","CODE_REGEXP"))
15 rows selected.
SQL> explain plan for
2 SELECT * FROM codes,code_expressions WHERE regexp_like(code,'^' ||
3 REPLACE (REPLACE (REPLACE (REPLACE (code_exp, 'a', '[0-9]'), '.', '\.'), 'b', '[1-9]'), ',') ||'$');
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 3098457583
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5000 | 205K| 57 (2)| 00:00:01 |
| 1 | NESTED LOOPS | | 5000 | 205K| 57 (2)| 00:00:01 |
| 2 | TABLE ACCESS FULL| CODE_EXPRESSIONS | 1 | 31 | 3 (0)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| CODES | 5000 | 55000 | 54 (2)| 00:00:01 |
Predicate Information (identified by operation id):
3 - filter( REGEXP_LIKE ("CODE",'^'||REPLACE(REPLACE(REPLACE(REPLACE("CODE_E
XP",'a','[0-9]'),'.','\.'),'b','[1-9]'),',')||'$'))
16 rows selected.Best regards
Maxim -
Time Out Dump while extracting data from table CKIS
Dear Friends,
I am getting TIme Out dump for the below code, while extracting data from table CKIS.
Table CKIS doesn't have any Indexes. Please guide me to resolve this.
Regards,
Viji.
form get_keko_ckis.
SELECT kalnr kalka kadky tvers bwvar matnr werks kokrs
FROM keko
INTO TABLE i_keko1
FOR ALL ENTRIES IN i_final_modify
WHERE matnr = i_final_modify-main_f
AND werks = p_werks
AND kokrs = p_kokrs
AND kadat = p_kadat
AND bidat = p_bidat
AND bwdat = p_bwdat.
IF sy-subrc = 0.
SORT i_keko1 BY kalnr kalka kadky tvers bwvar.
SELECT kalnr kalka kadky tvers bwvar posnr typps kstar
matnr menge gpreis
FROM ckis
INTO TABLE i_ckis_temp
FOR ALL ENTRIES IN i_keko1
WHERE kalnr = i_keko1-kalnr
AND kalka = i_keko1-kalka
AND kadky = i_keko1-kadky
AND tvers = i_keko1-tvers
AND bwvar = i_keko1-bwvar.
IF sy-subrc = 0.
SORT i_ckis_temp BY kalnr kalka kadky tvers bwvar.
LOOP AT i_ckis_temp INTO wa_ckis_temp.
wa_ckis-kalnr = wa_ckis_temp-kalnr.
wa_ckis-kadky = wa_ckis_temp-kadky.
wa_ckis-posnr = wa_ckis_temp-posnr.
wa_ckis-typps = wa_ckis_temp-typps.
wa_ckis-kstar = wa_ckis_temp-kstar.
wa_ckis-matnr1 = wa_ckis_temp-matnr1.
wa_ckis-menge = wa_ckis_temp-menge.
wa_ckis-gpreis = wa_ckis_temp-gpreis.
CLEAR wa_keko1.
READ TABLE i_keko1 INTO wa_keko1
WITH KEY kalnr = wa_ckis_temp-kalnr
kalka = wa_ckis_temp-kalka
kadky = wa_ckis_temp-kadky
tvers = wa_ckis_temp-tvers
bwvar = wa_ckis_temp-bwvar
BINARY SEARCH.
IF sy-subrc = 0.
wa_ckis-matnr = wa_keko1-matnr.
wa_ckis-werks = wa_keko1-werks.
ENDIF.
APPEND wa_ckis TO i_ckis.
CLEAR: wa_ckis_temp, wa_ckis.
ENDLOOP.
ENDIF.
REFRESH: i_keko1, i_ckis_temp.
ENDIF.
endform. " get_keko_ckisHi Try minimising the conditions in where clause
SELECT fields..... FROM CKIS
WHERE KALNR = KEKO-KALNR AND
KADKY = KEKO-KADKY AND
TVERS = KEKO-TVERS AND
TYPPS = 'M'.
after this, deleting unwanted records from internal table as per pending conditions...
Regds,
Anil -
Hello,
I would like to search
all of the table
names in a MySQL database using a simple HTML form and PHP.
I am stuck. I have attached the code I have so far. How do I apply
the search to just the table names in the database?
Thanks in advance,
JohnOn Thu, 12 Feb 2009 01:51:54 +0000 (UTC), "ArizonaJohn"
<[email protected]> wrote:
> Thanks for the help. When I try the code you suggest, it
gives me this error:
>
> Parse error: syntax error, unexpected T_FOREACH
>
> It looks like the "foreach" loop is not working. Any
ideas?
Well, I told you it was untested. ;-) It was missing a
semicolon at the
end of the line preceding the inner foreach. I had also
neglected to print
the opening <table> tag. This one is tested and works:
$result=mysql_query("SHOW TABLES FROM sand2 LIKE '%$find%'")
or die(mysql_error());
if(mysql_num_rows($result)>0){
while($table=mysql_fetch_row($result)){
print "<p style=\>Table: $table[0]</p>\n";
$r=mysql_query("SELECT * FROM `$table[0]`");
print "<table>\n";
while($row=mysql_fetch_row($r)){
print "<tr>";
foreach($row as $field){
print "<td>$field</td>";
print "</tr>\n";
print "</table>\n";
}else{
print "None found";
Gary -
Search * from t where a like b case-insensitive ?
I have a Database-field (CHAR60) that contains text with upper and lower case letters. In my application, the user can search for entries in the DB table using this field, which leads to an SQL statement like this:
SELECT * FROM table WHERE field LIKE pattern INTO...
My question:
If I search for "abc", i won't find entries with "aBc". Can I do a case-insensitive search with SELECT and LIKE?Hello Daniel,
What is the domain(CHAR60) for the field that you are searching for?
The domain has an attribute called <i>Lowercase</i>, and it is my understanding that so long as this is checked, the data will be stored in the database exactly like it was entered on the screen (case-sensitive).
If thst is the case with your domain, then I guess you would have to make do with something like:
SELECT *
FROM table.
TRANSLATE : TABLE-FIELD TO UPPERCASE,
PATTERN TO UPPERCASE.
IF TABLE-FIELD CS PATTERN.
* Do your processing here...or fill the internal table
ENDIF.
ENDSELECT.
I know this code has been a bit crude, but this is the essence.
Regards,
Anand Mandalika. -
Latest posting date from table MKPF
hi all,
I want to retrive the latest posting date from table MKPF. Here I am using the MARD,MSEG,MKPF tables to get the latest posting date.
if not it_mard[] is initial.
select amblnr amjahr amatnr awerks algort bbudat
into table it_mseg_mkpf
from mseg as a mkpf as b
on amblnr = bmblnr
and amjahr = bmjahr
for all entries in it_mard
where a~matnr = it_mard-matnr
and a~werks = it_mard-werks
and a~lgort = it_mard-lgort.
if sy-subrc eq 0.
sort it_mseg_mkpg decending by matnr werks lgort budat.
endif.
loop at it_mard.
clear it_mkpf_mseg.
read table it_mseg_mkpf with key matnr = it_mard-matnr
werks = it_mard=werks
lgort = it_mard-lgort
binary search.
if sy-subrc eq 0.
it_final-budat = it_mseg_mkpf-budat.
endif.
endloop.
from the above code i need to rereive the latest posting date , but when I am reading from internal table it is giving the sy-subrc is 4. i know when we use binary search , the standard table should be ascedning order. but here I need to use descedning order.
please hhelp i this.
regards,
AjayHi,
1. Check Storage location (LGORT) value available in the internal
table it_mseg_mkpf. Some case no value.
2. Remove the binary search after u try again. Like below.
loop at it_mard.
clear it_mkpf_mseg.
read table it_mseg_mkpf with key matnr = it_mard-matnr
werks = it_mard=werks
lgort = it_mard-lgort.
if sy-subrc eq 0.
it_final-budat = it_mseg_mkpf-budat.
endif.
endloop.
3. sort it_mseg_mkpg DESCENDING BY budat matnr werks lgort.
4. For all material (it_mard) may be or may not be there in the MSEG table.
So for some case SY-SUBRC = 4 will give.
Thanks,
Durai.V
Edited by: Durai V on Sep 9, 2008 6:50 AM -
Sending email with data from table
Hi,
I have search for many site but i didn't find any answer about this. How to send an email with a content from row of a table (I mean select a record from table and put in the email body and sent it)?
Should i give some code here?
ThanksHi,
This link has an example using utl_smtp package, [Sending email from the database with the Utl_Smtp package|http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html]. Also check this [utl_mail|http://www.psoug.org/reference/utl_mail.html]
Regards,
Edited by: Walter Fernández on Jul 14, 2009 12:29 AM - Adding other example... -
Pb retrieving sorted data from Table in SQL.
Hi,
I get problem to retrieve data in the right order from table in database SQL.
See code attached: code.png
I want to sort data according to ID number And then to retrieve those data and fill out a ring control in the right order "descending" .
But i got always ID 2 instead of 1. See attached picture : control.png
it seems that the select statement (see under) is not woking properly. But it is working well in a query in Access DataBase .
//Select statement
hstmt = DBActivateSQL (hdbc, ("SELECT * FROM %s ORDER BY ID DESCENDING",szTableName));
if (hstmt<= DB_SUCCESS) {ShowError(); goto Error;}
Some idea ??
Lionel.
Attachments:
code.PNG 39 KB
control.png 32 KBHello Lionel,
According to the document Robert linked, the prototype of DBActivateSQL() is:
int statementHandle = DBActivateSQL (int connectionHandle, char SQLStatement[]);
For the 2nd parameter(SQLStatement), you're sending:
("SELECT * FROM %s ORDER BY ID DESCENDING",szTableName)
Probably your intention is to substitute %s with szTableName, but that's not what it happens.
By using comma operator, ("SELECT * FROM %s ORDER BY ID DESCENDING",szTableName) is evaluated to szTableName, so you call is equivalent to:
hstmt = DBActivateSQL (hdbc, szTableName);
In order to substitute %s with szTableName you need to first build the string you're passing as the 2nd parameter:
char query[512];
sprintf(query, "SELECT * FROM %s ORDER BY ID DESCENDING",szTableName);
hstmt = DBActivateSQL (hdbc, query); -
Deleting the values from table control
HI,
I need to remove the selected line from the Table control on my screen.
The point is that the Internal table does not have any records,.
for example in the Customer Create screen,
while entering the bank details we will enter it in a tbale contraol.
but the records doesnt exist in the database. but the record gets deleted from the table control only if we press delete button.
please guide me.
please note : I want to delete the record from Table Control on the screen and I dont have any corresponding database records..
regardsHi..
The solution to your problem - deleting values from table control.
Here: it_wizard is the internal table which is holding the value of table control.
wa_wizard is the work are of the internal table it_wizard.
it_delete is the internal table which holds the deleted record of table control.
wa_delete is the work area of the internal table it_delete
Also here the field ZSEL is the character field which is used to select the entire record in the table control.
LOOP AT it_wizard into wa_wizard WHERE zsel = 'X'.
MOVE-CORRESPONDING wa_wizard TO wa_delete.
APPEND wa_delete TO it_delete.
delete table it_wizard from wa_wizard.
DELETE FROM zfin_goods WHERE ZFG = WA_delete-ZFG.
ENDLOOP
if sy-subrc eq 0.
Message 'Delete Successful' type 'S'.
endif.
The above code will delete the record from both the table control.internal table and the database table.
I think this will help you to great extent.
Ward regards,
Bhuvaneswari
Edited by: BHUVANESWARI THIRUNAVUKKARASU on Jan 7, 2009 10:39 AM -
How can I insert values from table object into a regular table
I have a table named "ITEM", an object "T_ITEM_OBJ", a table object "ITEM_TBL" and a stored procedure as below.
CREATE TABLE ITEM
ITEMID VARCHAR2(10) NOT NULL,
PRODUCTID VARCHAR2(10) NOT NULL,
LISTPRICE NUMBER(10,2),
UNITCOST NUMBER(10,2),
SUPPLIER INTEGER,
STATUS VARCHAR2(2),
ATTR1 VARCHAR2(80),
ATTR2 VARCHAR2(80),
ATTR3 VARCHAR2(80),
ATTR4 VARCHAR2(80),
ATTR5 VARCHAR2(80)
TYPE T_ITEM_OBJ AS OBJECT
ITEMID VARCHAR2(10),
PRODUCTID VARCHAR2(10),
LISTPRICE NUMBER(10,2),
UNITCOST NUMBER(10,2),
SUPPLIER INTEGER,
STATUS VARCHAR2(2),
ATTR1 VARCHAR2(80),
ATTR2 VARCHAR2(80),
ATTR3 VARCHAR2(80),
ATTR4 VARCHAR2(80),
ATTR5 VARCHAR2(80)
TYPE ITEM_TBL AS TABLE OF T_ITEM_OBJ;
PROCEDURE InsertItemByObj(p_item_tbl IN ITEM_TBL, p_Count OUT PLS_INTEGER);
When I pass values from my java code through JDBC to this store procedure, how can I insert values from the "p_item_tbl" table object into ITEM table?
In the stored procedure, I wrote the code as below but it doesn't work at all even I can see values if I use something like p_item_tbl(1).itemid. How can I fix the problem?
INSERT INTO ITEM
ITEMID,
PRODUCTID,
LISTPRICE,
UNITCOST,
STATUS,
SUPPLIER,
ATTR1
) SELECT ITEMID, PRODUCTID, LISTPRICE,
UNITCOST, STATUS, SUPPLIER, ATTR1
FROM TABLE( CAST(p_item_tbl AS ITEM_TBL) ) it
WHERE it.ITEMID != NULL;
COMMIT;
Also, how can I count the number of objects in the table object p_item_tbl? and how can I use whole-loop or for-loop to retrieve values from the table object?
Thanks.Sigh. I answered this in your other How can I convert table object into table record format?.
Please do not open multiple threads. It just confuses people and makes the trreads hard to follow. Also, please remember we are not Oracle employees, we are all volunteers here. We answer questions if we can, when we can. There is no SLA so please be patient.
Thank you for your future co-operation.
Cheers, APC -
Delete From Table on Cancel Button.
Hi,
i am facing funny problem.
i have created form with report page and i have implement send email option on Page so i am attach more document with email.if i attach document then it's going in DUMY_DOC_FILE table .
i have create a process
delete from DUMY_DOC_FILE .
Process Point IS ON Submit -After Conmputation and Validation
On Page No 6.if i press Cancel Button.This button is redirect on page No 4.My Code on Page no 6.
page is redirect to 4 but doc don't delete from DUMY_DOC_FILE Table.
How to delete Doc From Table If I press Cancel Button.
Thanks
Edited by: 805629 on Jan 13, 2011 5:25 AM
Edited by: 805629 on Jan 13, 2011 11:49 PM
Edited by: 805629 on Jan 14, 2011 12:43 AM<li>Change Cancel Button in page 6 so that it submits.
<li>If u have conditions on that delete PLSQL process, make sure that it runs when CANCEL button is pressed also. If it is unconditional, let it be.
<li>Add a branch for the Cancel button which redirect to page 4
So effectivelly instead of *[CANCEL] -> [Redirect to page 4]* , it becomes *[CANCEL] -> [SUBMIT] -> [DELETE PROCESS] -> [Branch: redirect to page 4]* -
Update PRODH field from table T179T
hi,
i want to update PRODH field from table T179T into table VBRP. for this we
need to take selection option also.
selection option will be :
· Sales Organization (field VBRK-VKORG)
· Billing Date Range (VBRK-FKDAT)
· Distribution Channel (Vbrk-vtweg
while i have done this for one field by using hard code but like:
TABLES: VBRP.
CLEAR VBRP.
UPDATE VBRP SET PRODH = 'PLC01' WHERE VBELN = '0008300051'.
SELECT SINGLE * FROM VBRP WHERE VBELN = '0008300051'.
WRITE: VBRP-VBELN,VBRP-PRODH.
but this is not the right way. please guide me how to solve this.TABLES: VBRP.
CLEAR VBRP.
UPDATE VBRP SET PRODH = 'PLC01' WHERE VBELN = '0008300051'.
<b>commit work.</b>
SELECT SINGLE * FROM VBRP WHERE VBELN = '0008300051'.
WRITE: VBRP-VBELN,VBRP-PRODH.
use commit work after update statement.
But this code would make vbrp-vbeln as plc01 only.
If you want to get the prodh value from t179t, then write a sleect on t179t and then update.
TABLES: VBRP.
CLEAR VBRP.
select single prodh
from t179t
where......
UPDATE VBRP SET PRODH = t179-prodh WHERE VBELN = '0008300051'.
commit work.
SELECT SINGLE * FROM VBRP WHERE VBELN = '0008300051'.
WRITE: VBRP-VBELN,VBRP-PRODH. -
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.
Maybe you are looking for
-
Ipod not recognised by ITunes - have tried everything
Hi all My Ipod was running smoothly with Windows until a few weeks back. I've gone through ALL of the procedures suggested (that I could find anyway) and none have worked. I tried to completely reset the IPod as all else has failed and I can't even d
-
Embedding XE in Application. Please Help
Hi. I have developed an application and also have created the setup using Installshield. I want to embed Oracle XE as a part of the application installation procedure.I would like to understand and know the following things 1) After installing the ap
-
I send an iWeb link but some users receive a warning that site is undesirable and won't open the site.
-
Heap errors in Windows NT 4.0
Running a Java app under JRE version 1.4.1_03-b02 on a PC running NT 4.0 with 256 MB RAM. The app runs 7x24 doing OCR and business logic. The app uses JNI to talk to a C++ DLL, uses Oracle JDBC thin driver, Javacomm 2.0. It has been stable for severa
-
Quick question when purchasing prints through iPhoto
Just a real quick question. When I select photos I want to purchase from my iphoto collection, i know it hooks into Kodak. My question is, is an account created for me on Kodak's site that keeps my collection and allows me to log in from anywhere to