Help - Bean Binding an SQL join to a gui component(jtable) in Netbeans?
Good afternoon. I'd like to ask if there is a way to data bind an SQL Join from 2 or more tables to a
GUI component(Jtable) in Netbeans. All the tutorials show is how to bind all the fields of 1 database table
to the component. Under the BIND/ELements option the IMPORT DATA TO FORM menu only allows
you to choose 1 among the database tables from a selected database.
Is there a way to configure an SQL query and attach it to the component?
Thanks.
This is not a Swing problem. Try a NetBeans forum.
Similar Messages
-
SQL Experts,
I have a query below. Can I improve the SQL joining order in highlighted section - Lines 31 to 40
SNIOTM.SNI_PA_OTM_ARC_DRVR -- around 200K rows
SNIOTM.SNI_PA_ORD_SHP_STATUS -- 8 rows
Edited by: 922411 on May 12, 2013 7:42 PM922411 wrote:
SQL Experts,
I have a query below. Can I improve the SQL joining order in highlighted section - Lines 31 to 40
SNIOTM.SNI_PA_OTM_ARC_DRVR -- around 200K rows
SNIOTM.SNI_PA_ORD_SHP_STATUS -- 8 rowsYou need not worry about the Joining Order, Oracle CBO is efficient enough to choose the Most Efficient way of joining the tables. However, it will depend on your Oracle Version, which you have not mentioned. If you are 10g or higher then you certainly need not worry.
If you sense a problem in performance of query, then I will suggest you read the linked threads in {message:id=9360003} and post the details as specified.
Only this will help us provide releavant suggestions and avoid guessing games.
PS:- Do not forget to post Oracle Version and the Explain Plan in {noformat}{noformat} tags, exactly as specified. -
SQL JOIN with BPM sql component
Hello friends.
How to use SQL JOIN with BPM sql component?
The tables objects are created but the joined tables belong to different sql components .
I tried something like that, but a error "table doesn't exist" occours.
Ex:
for each element in
SELECT imuImovelCd
FROM IMOVEIS_URBANOS,
Integracao.FGLP.IMOVEIS_PRE_EDITAIS
WHERE IMOVEIS_URBANOS.imuImovelCd = Integracao.FGLP.IMOVEIS_PRE_EDITAIS.ipeImuCd
AND Integracao.FGLP.IMOVEIS_PRE_EDITAIS.ipePedNr = 1
AND Integracao.FGLP.IMOVEIS_PRE_EDITAIS.ipePedAa = 2008
do
extend this.imoveis using cdImovel = element.imuimovelcd,
nrImovel = call(DEC_ENDERECO, codimovel : element.imuimovelcd, tipoimovel : 1)
end
Edited by: user9008295 on 26/01/2010 05:19ok, ok you are right.
When I try use SQL Statement to make a JOIN with 2 tables on different sql objects, BPM returns "table dosn't exists".
So.... I change my code. I dont know if this is the best way to do, but... i hope u, or everyone, can help me to do a best work.
This code works fine.
for each element in
SELECT ipeImuCd
FROM Integracao.FGLP.IMOVEIS_PRE_EDITAIS
WHERE Integracao.FGLP.IMOVEIS_PRE_EDITAIS.ipePedNr = 1
AND Integracao.FGLP.IMOVEIS_PRE_EDITAIS.ipePedAa = 2008
do
for each element2 in
SELECT imuImovelDv
FROM IMOVEIS_URBANOS
WHERE imuImovelCd = element.ipeImuCd
do
extend this.imoveis using cdDvImovel = String(element2.imuImovelDv),
cdImovel = Decimal(element.ipeImuCd),
endereco = call(DEC_ENDERECO, codimovel : element.ipeImuCd, tipoimovel : 1)
end
end
Thx a lot!!! -
SQL JOIN - better solution?
Hello!
I have 4 tables with main column TIME - with same rage in each of them. Range is [135764404,181396830].
For example, in 1. table you can find columns - time with mentioned and ID1,ID2,ID3. In second same time column and ID4,ID5,ID6 .. etc
If I want to select table1.ID1 , table2.ID4 and table3.ID8 , only option is
SELECT table1.ID1, table2.ID4, table3.ID8
FROM table1
JOIN table2 ON table1.TIME = table2.TIME
JOIN table3 ON table1.TIME = table3.TIME
WHERE table1.TIME > 1359509180 AND table1.TIME < 135951000
If you can help me with better sql query, please do it! :) (better = shorter)
Thank you!Hi,
This is a shorter query that will get the same results:
SELECT *
FROM dual
WHERE 0 = 1;Both will produce "no rows selected".
Ondrej T. wrote:
SELECT table1.ID1, table2.ID4, table3.ID8
FROM table1
JOIN table2 ON table1.TIME = table2.TIME
JOIN table3 ON table1.TIME = table3.TIME
WHERE table1.TIME > 1359509180 AND table1.TIME < 135951000If you format the WHERE clause above you'll see why:
WHERE table1.TIME > 1359509180
AND table1.TIME < 135951000If either one of those conditions is TRUE, the other one will be FALSE.
If you change the WHERE clause so that it can be TRUE (change AND to OR, for example), then I don't think there's any way to shorten the code significantly.
If you need to display 3 items, then you need 3 items in the SELECT clause.
If those items are coming from 3 different tables, and they are joined as you indicated, then you need 3 tables in the FROM clause, and 2 join conditions.
You might cut a few keystokes off by using table aliases:
SELECT t1.ID1, t2.ID4, t3.ID8
FROM table1 t1
JOIN table2 t2 ON t1.TIME = t2.TIME
JOIN table3 t3 ON t1.TIME = t3.TIME
WHERE t1.TIME > 1359509180
OR t1.TIME < 135951000 -
Please help on binding variables
Hello,
I need to bind the variable in following function.
If the single deptno is passed into function, the function will return correct result. However, if the set of deptno is passed, the function cannot give correct result.
Could anyone please help me on it...
Thanks in advance!!!
scott@ORA111>create or replace function my_test (p_deptno_list varchar2)
2 return sys_refcursor
3 as
4 rec sys_refcursor;
5 v_sql varchar2(1000);
6
7 begin
8 v_sql := 'select * from emp where deptno in (:1)';
9 open rec for v_sql using p_deptno_list;
10 return rec;
11
12 end;
13 /
Function created.
Elapsed: 00:00:00.04
scott@ORA111>var my_rec refcursor
scott@ORA111>execute :my_rec := my_test('10');
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
scott@ORA111>print :my_rec
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7839 KING PRESIDENT 17-NOV-81 5000 10
7934 MILLER CLERK 7782 23-JAN-82 1300 10
9999 TEMP SALESMAN 7782 27-APR-09 6000 10
Elapsed: 00:00:00.01
scott@ORA111>var my_rec refcursor
scott@ORA111>execute :my_rec := my_test('10, 20');
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01
scott@ORA111>print :my_rec
ERROR:
ORA-12801: error signaled in parallel query server P000
ORA-01722: invalid number
no rows selected
Elapsed: 00:00:00.01Hello Beijing,
Thank you so much for your help!!!
We need a procedure/function to take the inputs as query conditions, execute the query, store the result in refer cursor and pass it into Client Application.
With the help on this Forum, I have done following test. Only one thing that I have not figure out is the variable-list. As you know the line 15 in my procedure will not give the correct result. However, I am not able to concatenate the bind variable in the string.
Please help, thanks again.
SQL> create or replace function test_function
2 (p_deptno_list varchar2,
3 p_hire_start emp.hiredate%type,
4 p_hire_end emp.hiredate%type,
5 p_job emp.job%type)
6 return sys_refcursor
7 as
8 rec sys_refcursor;
9 v_sql varchar2(1000);
10
11 begin
12 v_sql := 'select * from emp';
13
14 if p_deptno_list is not null then
15 v_sql := v_sql ||' where instr(replace(:1, '' '', ''''), deptno) > 0';
16 else
17 v_sql := v_sql ||' where :1 is null';
18 end if;
19
20 if p_hire_start is not null and p_hire_end is not null then
21 v_sql := v_sql ||' and hiredate between :2 and :3';
22 else
23 v_sql := v_sql ||' and :2 is null and :3 is null';
24 end if;
25
26
27 if p_job is not null then
28 v_sql := v_sql ||' and job = :4';
29 else
30 v_sql := v_sql ||' and :4 is null';
31 end if;
32
33 open rec for v_sql using p_deptno_list, p_hire_start, p_hire_end, p_job;
34 return rec;
35
36 end;
37 /
Function created.
SQL> set lin 200
SQL> var rec refcursor
SQL> execute :rec := test_function(null, null, null, null);
PL/SQL procedure successfully completed.
SQL> print rec
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 3450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 6000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 4300 10
14 rows selected.
SQL> execute :rec := test_function('20, 30', null, null, null);
PL/SQL procedure successfully completed.
SQL> print rec
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
11 rows selected.
SQL> execute :rec := test_function('20', to_date('01-JAN-1981','DD-MON-YYYY'), to_date('31-DEC-1981','DD-MON-YYYY'), null);
PL/SQL procedure successfully completed.
SQL> print rec
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 2975 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
SQL> execute :rec := test_function('20', to_date('01-JAN-1981','DD-MON-YYYY'), to_date('31-DEC-1981','DD-MON-YYYY'), 'MANAGER');
PL/SQL procedure successfully completed.
SQL> print rec
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 2975 20
SQL> spool off -
Please help me convert the SQL to HQL
select
count(*) as col_0_0_
from
edu.hr_people_all hrpeopleal0_
left outer join
edu.conditions_journal conditions1_
on hrpeopleal0_.people_id=conditions1_.people_id
and conditions1_.personal_number like '%'
where
hrpeopleal0_.status=11Hibernate version: 3
HQL as I 've done
FROM PMSProjectsORO pjt LEFT JOIN PMSChecklistORO pcl
ON pjt.projectId = pcl.projectId order by
pjt.projectCode ascHQL is probably incorrect.
Try this:
FROM
PMSProjectsORO pjt
LEFT JOIN
PMSChecklistORO pcl
ORDER BY
pjt.projectCode asc>
Original SQL for MSQL5:
FROM PMSProject LEFT JOIN PMSCheckList ON
PMSProject.PROJECT_ID = PMSCheckList.PROJECT_ID order
by PMSProject.PROJECT_CODE desc
Name and version of the database you are using:
MYSQL 5
Please help me convert the sql to hql since what i
've done is throwing error like unexpected token...
Please reply ASAPLet me know if that's better.
% -
Converting oracle join to Ansi sql join
Hi Guys,
I am new to SQL and trying to convert the following Oracle query (joins) into ANSI sql joins...Can someone please help me?
SELECT M.EXTERNALCODE, M.NAME AS MNAME, SC.BIRIM, SM.TRANSACTIONDATE, SMD.AMOUNT,
SMD.UNITPRICE, SM.ID AS SMID, SMD.ID AS SMDID, F.NAME AS FNAME,
IFNULL (SMD.AMOUNT, 0, SMD.AMOUNT) * IFNULL (SMD.UNITPRICE, 0, SMD.UNITPRICE) AS TOTALPRICE, SMD.AMOUNT AS RECEIVED_QUANTITY,
PD.ORDERID, PD.AMOUNT QUANTITY, PO.PROCESSDATE
FROM STOCKMAINTRANSACTION SM,
STOCKMAINTRANSACTIONDETAIL SMD,
MATERIAL M,
STOCKCARD SC,
FVSTOCK FVS,
FIRM F,
PURCHASEORDER PO,
PURCHASEORDERDETAIL PD,
PURCHASEORDERDETAILSUPPLIED PDS
WHERE SM.ID = SMD.MAINTRANSACTIONID
AND SMD.MATERIALID = M.ID
AND SMD.STOCKCARDID = SC.ID
AND SM.PROPREF = FVS.RECORDID(+)
AND FVS.FIELDID(+) = 2559
AND FVS.FLEVEL(+) = 'F'
AND F.ID(+) = SUBSTR (FVS.FVALUE, 1, 9)
AND SM.TRANSDEFID in (999,2329,2344,2370,150000903,150005362)
AND SMD.CANCELLED = 0
AND SMD.STOCKUPDATED = 1
AND SMD.ID = PDS.STOCKMAINTRANSACTIONDETAILID
AND PDS.ORDERDETAILID = PD.ORDERDETAILID
AND PO.ORDERID = PD.ORDERID
AND (M.ID = {@MATERIALID@} OR {@MATERIALID@} = 0)
AND (SM.STOREID = {@STOREID@} OR {@STOREID@} = 0)
AND (F.ID = {@SUPPLIERID@} OR {@SUPPLIERID@} = 0)
AND SM.TRANSACTIONDATE BETWEEN {@STARTDATE@} AND {@ENDDATE@}
ORDER BY F.NAME, M.EXTERNALCODE, SM.TRANSACTIONDATE
Really appreciate the help!
Thanks.Hi,
Welcome to the forum!
To convert to ANSI syntax, replace join conditions in the WHERE clause
FROM x
, y
WHERE x.x1 = y.y1
AND x.x2 = y.y2with ON conditions in the FROM clause:
FROM x
JOIN y ON x.x1 = y.y1
AND x.x2 = y.y2In inner joins, conditions that do not reference 2 tables are not really join conditions, so it doesn't matter if they are in the FROM clause or in the WHERE clause.
In your case
SM.TRANSDEFID in (999,2329,2344,2370,150000903,150005362)could be part of a join condition involving sm, or it could be in the WHERE clause. Most people find it clearer if 1-table conditions like this are in the WHERE clause.
Again, this only applies to inner joins. For outer joins, all conditions that apply to a table that may lack matching rows must be included in the FROM clause, like this:
LEFT OUTER JOIN fvstock fvs ON sm.propref = fvs.recordid
AND fvs.fieldid = 2559
AND fvs.flevel = 'F'Try it.
If you have trouble, post your best attempt, along with CREATE TABLE and INSERT statements for a little sample data from all the tables involved, and the results you want from that data. Simplify the problem. Post only the tables and columns that you don't know how to handle.
See the forum FAQ {message:id=9360002}
user8428528 wrote:
AND (M.ID = {@MATERIALID@} OR {@MATERIALID@} = 0)
AND (SM.STOREID = {@STOREID@} OR {@STOREID@} = 0)
AND (F.ID = {@SUPPLIERID@} OR {@SUPPLIERID@} = 0)
AND SM.TRANSACTIONDATE BETWEEN {@STARTDATE@} AND {@ENDDATE@}This is not valid Oracle SQL. Is {@MATERIALID@} some kind of variable? -
If someone could help me figure out what joins I need to do to handle the following, I would be greatly appreciative.
Our Oracle Order Order Header has flex fields that are used to track a special address by it's code which is stored in Attribute 13 on OE_ORDER_HEADERS_ALL table. We use a site usage code called ADMIN_BY to set up a site in the customers table so we can place the address we are linking here. So for instance, if the order had AB-XXXXXX in it's attribute 13 field, I want to look for this same code in the customer site usage table and find the address in HZ_LOCATIONS table or null if attribute 13 does not have data. My only problem is taking care of the NULL case for all previous orders that did not contain this information.
This is my sql query whcih works if we have a valid entry in attribute 13. This is also set up for a specific order number for testing only.
SELECT DISTINCT
ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER, AR.HZ_LOCATIONS.LOCATION_ID, AR.HZ_PARTY_SITES.LOCATION_ID AS LOC_ID,
AR.HZ_PARTY_SITES.PARTY_SITE_ID, AR.HZ_PARTY_SITES.PARTY_ID, ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID,
ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE13, ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE14, AR.HZ_LOCATIONS.ADDRESS1,
AR.HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID AS P_SITE_ID, AR.HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID,
AR.HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID AS CUST_ACCT_S_ID, AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE
FROM AR.HZ_PARTY_SITES, AR.HZ_LOCATIONS, ONT.OE_ORDER_HEADERS_ALL, AR.HZ_CUST_ACCT_SITES_ALL, AR.HZ_CUST_SITE_USES_ALL
WHERE AR.HZ_PARTY_SITES.LOCATION_ID = AR.HZ_LOCATIONS.LOCATION_ID AND
AR.HZ_PARTY_SITES.PARTY_ID = ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID AND
AR.HZ_PARTY_SITES.PARTY_SITE_ID = AR.HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID AND
AR.HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID = AR.HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID AND
ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE13 = AR.HZ_CUST_SITE_USES_ALL.LOCATION AND
(ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER = TO_NUMBER('5074920')) AND (AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE = 'ADMIN_BY')
I tried this code to no avail.
SELECT DISTINCT
ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER, AR.HZ_LOCATIONS.LOCATION_ID, AR.HZ_PARTY_SITES.LOCATION_ID AS LOC_ID,
AR.HZ_PARTY_SITES.PARTY_SITE_ID, AR.HZ_PARTY_SITES.PARTY_ID, ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID,
ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE13, ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE14, AR.HZ_LOCATIONS.ADDRESS1,
AR.HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID AS P_SITE_ID, AR.HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID,
AR.HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID AS CUST_ACCT_S_ID, AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE
FROM AR.HZ_PARTY_SITES, AR.HZ_LOCATIONS, AR.HZ_CUST_ACCT_SITES_ALL, ONT.OE_ORDER_HEADERS_ALL, AR.HZ_CUST_SITE_USES_ALL,
ONT.OE_ORDER_HEADERS_ALL OE_ORDER_HEADERS_ALL_1
WHERE AR.HZ_PARTY_SITES.LOCATION_ID = AR.HZ_LOCATIONS.LOCATION_ID AND
AR.HZ_PARTY_SITES.PARTY_SITE_ID = AR.HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID AND
AR.HZ_PARTY_SITES.PARTY_ID = ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID AND
AR.HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID = AR.HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID AND
AR.HZ_CUST_SITE_USES_ALL.LOCATION (+) = OE_ORDER_HEADERS_ALL_1.ATTRIBUTE13 AND
(ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER = TO_NUMBER('5074920')) AND
(AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE (+) = 'ADMIN_BY')
Any assistance would be greatly appreciated.Thanks for the reply Rob.
Your input did help me return values for my query but I got 5 returned rows where I'm trying to return a single line. I modified my sql query with your recommendations.
SELECT DISTINCT
ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER, ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID,
ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE13, ONT.OE_ORDER_HEADERS_ALL.ATTRIBUTE14, AR.HZ_LOCATIONS.ADDRESS1,
AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE
FROM AR.HZ_PARTY_SITES, AR.HZ_LOCATIONS, AR.HZ_CUST_ACCT_SITES_ALL, ONT.OE_ORDER_HEADERS_ALL, AR.HZ_CUST_SITE_USES_ALL,
ONT.OE_ORDER_HEADERS_ALL OE_ORDER_HEADERS_ALL_1
WHERE AR.HZ_PARTY_SITES.LOCATION_ID = AR.HZ_LOCATIONS.LOCATION_ID (+) AND
AR.HZ_PARTY_SITES.PARTY_SITE_ID (+) = AR.HZ_CUST_ACCT_SITES_ALL.PARTY_SITE_ID AND
AR.HZ_PARTY_SITES.PARTY_ID = ONT.OE_ORDER_HEADERS_ALL.SOLD_TO_ORG_ID (+) AND
AR.HZ_CUST_ACCT_SITES_ALL.CUST_ACCT_SITE_ID (+) = AR.HZ_CUST_SITE_USES_ALL.CUST_ACCT_SITE_ID AND
AR.HZ_CUST_SITE_USES_ALL.LOCATION (+) = OE_ORDER_HEADERS_ALL_1.ATTRIBUTE13 AND
(ONT.OE_ORDER_HEADERS_ALL.ORDER_NUMBER (+) = TO_NUMBER('5074417')) AND
(AR.HZ_CUST_SITE_USES_ALL.SITE_USE_CODE (+) = 'ADMIN_BY')
Here is the results for 2 different Order Numbers
For the first order which has a null value in attribute 13, here is the results
NULL NULL NULL NULL 1042nd AVIATION CO. ADMIN_BY
NULL NULL NULL NULL 437 APS OUTBOUND FREIGHT ADMIN_BY
NULL NULL NULL NULL DCMC DETROIT - GRAND RAPIDS ADMIN_BY
NULL NULL NULL NULL FB5621 ADMIN_BY
NULL NULL NULL NULL NULL NULL
For the next order which does have a value in attribute 13,
5075315 3069 AB-S2303B IB-S2303B 437 APS OUTBOUND FREIGHT ADMIN_BY
5075315 3069 AB-S2303B IB-S2303B DCMC DETROIT - GRAND RAPIDS ADMIN_BY
5075315 3069 AB-S2303B IB-S2303B FB5621 ADMIN_BY
NULL NULL NULL NULL 1042nd AVIATION CO. ADMIN_BY
NULL NULL NULL NULL NULL NULL
What I need is for them both to return a single line. The second order should have read...
5075315 3069 DCMC DETROIT - GRAND RAPIDS ADMIN_BY AB-S2303B IB-S2303B
while the first order didn't even list the Order number.
Any thoughts? -
Beans Binding: JList + Converter = convertForward not called
Hello,
I'm having difficulty getting beans binding of a JList selectedElements to work with a converter.
I have a master detail generated app in Netbeans 6.1 b1. When I select the master table, my detail elements are all updating nicely except for a JList. The source property is a String (CSV) which I would like to run through a converter to turn the CSV into a List that the JList selectedElements can use. Unfortunately the converter's convertForward method is never called. If I select items in my JList, then the converter's convertReverse is called however the underlying source value is not updated. I'm obviously missing something here (either code or understanding!), could anyone please help me?
Best regards,
Chris.
The code is as follows:
Converter:
import java.util.*;
import org.jdesktop.beansbinding.Converter;
public class AdditionalFeaturesConverter extends Converter<String, List<MyEntity>>{
@Override
public List<MyEntity> convertForward(final String csv) {
// will implement once I get this called ;)
return new ArrayList<MyEntity>();
@Override
public String convertReverse(final List<MyEntity> selected) {
final StringBuilder csv = new StringBuilder();
for (MyEntity entity : selected) {
if (csv.length() > 0) {
csv.append(',');
csv.append(entity.getId());
return csv.toString();
Netbeans generated code. Note: the EL worked perfectly for the default generated String -> JTextField binding.
private void initComponents() {
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.additionCashbackFeatures}"), jList1, org.jdesktop.beansbinding.BeanProperty.create("selectedElements"));
binding.setConverter(new testapp.AdditionalFeaturesConverter());
bindingGroup.addBinding(binding);
}There is definitely something strange going on here.
When I select from my master list, the binding does not set the selected items in the JList. In fact, the opposite is true - when I select from the master table and the newly selected property is overwritten with the last selection state of the JList.
Has anyone seen this before? -
Need help in rewriting a sql query
Can any one please tell me if there is any utility that can help me correcting the sql I have I need to tune the query as its taking lot of time. I want to use some tool that will help me re-formating the query.
Any help in this regard will be highly appreciated.If you think that Oracle SQL Tuning Tools like SQL Tuning Advisor and SQL Access Advisor are not helping.
You might look into thrid party tools like Quest- SQL Navigator and TOAD.
But I don't advise this based on the following:
Re: Oracle Third Party Tools and Oracle Database
Oracle have enough tools of its own to satisfy the various needs.
Adith -
Help needed in framing SQL query.
Hi,
I have table having following schema:
PRODUCT_ID INT
DATE DATETIME
ITEMS_SOLD INT
This table contains data for a week (sunday to saturday). I want to write an SQL query to get (filter out) PRODUCT_ID of products which has same no. of ITEMS_SOLD for all 7 days. Also for given PRODUCT_ID I need to find the longest period of successive days where the no. of ITEMS_SOLD is same for all days in this period. Eg.(PRODUCT_ID 23 was sold as following along the week in no. of units sold: 4,6,6,6,6,7,4 .So the longest period is *4 days* from Monday to Thursday.) The first condition is special case of second condition where no. of days is 7.
Any help to get the SQL query will be appreciated.
Thanks,
Akshay.PRODUCT_ID DATE ITEMS_SOLD
1 10/10/2011 3
1 11/10/2011 3
1 12/10/2011 3
1 13/10/2011 3
1 16/10/2011 5
2 10/10/2011 4
2 11/10/2011 4
2 12/10/2011 4
2 13/10/2011 4
2 14/10/2011 4
2 15/10/2011 4
2 16/10/2011 4
Output:
PRODUCT_ID ITEMS_SOLD NO_OF_DAYS
1 3 4
2 4 7
Explanation of results:
The table to be queried contains data for 1 week: from 10/10/2011(Sunday) to 16/10/2011(Saturday). Now, product with PRODUCT_ID '1' was sold on dates 10,11,12,13,16. Out of these 5 days 3 units were sold on 4 successive days (from 10-13). So output should be like :
PRODUCT_ID ITEMS_SOLD NO_OF_DAYS
1 3 4
as longest period of successive days is 4 where same no. of units were sold i.e 3 units (other period is of 1 day on 16th ).
For PRODUCT_ID 2 we have only one period of 7 days where 4 units were sold each day. So we output :
PRODUCT_ID ITEMS_SOLD NO_OF_DAYS
2 4 7
Other case where same PRODUCT_ID have different units sold on each day should be ignored.
I hope that clarifies the problem more. Let me know in case I have missed out anything which should have been mentioned.
-Akshay. -
Equivalent of SQL JOINs using XML + XPath
I have been working on a Java app for a while that takes user queries and searches various translations of the Bible. The data is stored in 66 .xml files, one per book of the Bible, and those files, in turn, are stored in a .jar file.
The user may select 2 or more translations and see them in parallel. So for example, let's say that want Matthew chapter 1 and verses 1 to 10 from KJV and ASV. I simply use the following XPath expression: /book/chapter[@num=1]/verse[@num>=1 and @num<=10] . Then I use XPathFactory, XPath, compile() and evaluate() on Matthew.xml from kjv.jar and asv.jar.
However, the problem is not so simple for keyword queries from the user. In such a case the tool searches for keywords in one translation and then finds the same verses from all subsequent translations. Here the XPath expression might be more like: /book/chapter/verse[contains(., 'keyword1') and contains(., 'keyword2')] for the first translation. However, if I ran the same query on subsequent translations they may or may not return the exact same set of verses (depending on language (English, Greek, Hebrew) and also on the dialect (Old English vs. Modern English)). So, my question is what is the most efficient way of obtaining the same verses from subsequent translations?
I could simply look up the verses in the first translation, then use DOM API calls to find the chapter and verse numbers, and look those up in the other translations. But this seems tedious, SLOW, and possibly more error prone.
Also, a second question: if I wanted to include a help file in my application's .jar file. How could I access that file programmatically? That is, how do I tell the application to look for "help.html" in the jar file so I can manipulate and/or display the contents to the user?
And last question: since, I'm still learning my way around Java and XML, how would I go about programmatically applying a .xsl file to some given .xml input to produce HTML + CSS output? What classes, interfaces, etc. should I look up for this? And can anyone point me to sample code online for this?However, the problem is not so simple for keyword
queries from the user. In such a case the tool
searches for keywords in one translation and then
finds the same verses from all subsequent
translations. Here the XPath expression might be
more like: /book/chapter/verse[contains(.,
'keyword1') and contains(., 'keyword2')] for the
first translation. However, if I ran the same query
on subsequent translations they may or may not return
the exact same set of verses (depending on language
(English, Greek, Hebrew) and also on the dialect (Old
English vs. Modern English)). So, my question is
what is the most efficient way of obtaining the same
verses from subsequent translations?
I could simply look up the verses in the first
translation, then use DOM API calls to find the
chapter and verse numbers, and look those up in the
other translations. But this seems tedious, SLOW,
and possibly more error prone.There's nothing in XPath that I know of that helps with this. SQL is relational, XML is hierarchical. They're fundamentally different.
Also, a second question: if I wanted to include a
help file in my application's .jar file. How could I
access that file programmatically? That is, how do I
tell the application to look for "help.html" in the
jar file so I can manipulate and/or display the
contents to the user?If it's an HTML file, it's likely that you'll package it in a WAR file, along with the rest of your app. It's accessible as a URL that way.
And last question: since, I'm still learning my way
around Java and XML, how would I go about
programmatically applying a .xsl file to some given
.xml input to produce HTML + CSS output? What
classes, interfaces, etc. should I look up for this?.xsl transformations are applied using XSL-T engines, like Apache's Xalan. You would embed the HTML that you want to inject the XML data into in the XSL-T stylesheet.
That's one way. Another is to use a templating alternative like Velocity.
And can anyone point me to sample code online for this?Try the Apache Xalan docs. Or this:
http://www.cafeconleche.org/books/xmljava/chapters/ch17.html
% -
Hi All,
I am using EXEC SQL join in my ABAP report,but it is giving dump.could you please correct my following code?
START-OF-SELECTION.
CONCATENATE '%' pa_match '%' INTO tp_match.
EXEC SQL.
OPEN dbcur FOR
SELECT kunnr,name1, banks
FROM kna1 as a inner join
knbk as b
on akunnr = bkunnr
WHERE a.kunnr = b.kunnr and
upper(a~name1) LIKE :tp_match
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT dbcur INTO :wa_name1
ENDEXEC.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND wa_name1 TO ta_name1.
COLLECT wa_name1 INTO ta_name1.
ENDDO.
EXEC SQL.
CLOSE dbcur
ENDEXEC.Remove the 'As' from the statement
EXEC SQL.
OPEN dbcur FOR
SELECT kunnr,name1, banks
FROM kna1 a inner join "Delete 'AS' here
knbk b
on a~kunnr = b~kunnr
WHERE a.kunnr = b.kunnr and
upper(a~name1) LIKE :tp_match
ENDEXEC. -
Can anybody help....SQL to display row as column and column as rows
Can anybody help in writing a SQL to display row as column and column as rows?
Thankscheck this link:
Re: Creating Views - from rows to a new column? -
Hi
How to use ANSI SQL JOINS (9i) for below query
SELECT EMP.EMPNO,EMP_T.TNO,EMP_T.SAL1 FROM EMP,EMP_T WHERE EMP.EMPNO=EMP_T.TNO
UNION ALL
SELECT EMP.EMPNO,EMP_T.TNO,EMP_T.SAL2 FROM EMP,EMP_T WHERE EMP.EMPNO=EMP_T.TNO
UNION ALL
SELECT EMP.EMPNO,EMP_T.TNO,EMP_T.SAL3 FROM EMP,EMP_T WHERE EMP.EMPNO=EMP_T.TNO
EMPNO TNO SAL1
7369 7369 100
7499 7499 1000
7566 7566 400
7782 7782 4000
7369 7369 200
7499 7499 2000
7566 7566 500
7782 7782 5000
7369 7369 300
7499 7499 3000
7566 7566 600
EMPNO TNO SAL1
7782 7782 6000
Regards
MMSELECT EMP.EMPNO,
EMP_T.TNO,
EMP_T.SAL1
FROM EMP
JOIN EMP_T ON ( EMP.EMPNO = EMP_T.TNO )
UNION ALL
SELECT EMP.EMPNO,
EMP_T.TNO,
EMP_T.SAL2
FROM EMP
JOIN EMP_T ON ( EMP.EMPNO = EMP_T.TNO )
UNION ALL
SELECT EMP.EMPNO,
EMP_T.TNO,
EMP_T.SAL3
FROM EMP
JOIN EMP_T ON ( EMP.EMPNO = EMP_T.TNO )
Maybe you are looking for
-
Decimal Issue while posting annual salary using HCM P&F
Hello All We are facing a strange problem while updating the Annual Salary of Infotype 0008 using HCM P&F. User in the form can enter a wage type amount, based on this wage type amount the annual salary is getting calculated by the std. way. Now the
-
How to use TO_DATE function in OBI having MSSQL DB
Hello Experts, I am facing a problem plz help me..... I've just created an business application using Oracle BI Administration Tool of Oracle BI Server version 10.1.3.4.1,with oracle DB. But currently we migrate from Oracle to MSSQL Server. Due to wh
-
Weird problem with http connection
hi, i'm trying to implement a midlet that connects the mobile to an http server. i've downloaded several midlets and also tried the method given in the MIDP2 api documentation, but i doesn't work, it can't connect. i tried it on several phones and so
-
Error when we run gpupdate /force
We have the following GPO setting being applied to our XP workstations. User Config \ policies \ admin templates \ windows components \ internet explorer \ internet control panel \ security page \ Site to Zone Assignment List Then in this list we hav
-
This is so ******* irriating i got locked out of my phone and im trying to fix that by downloading itunes and its not ******* working so fix your god **** software