Using Variables in a select statement through a Database Adapter
I was wondering how I reference a variable in a select statement through a Database Adapter.
Ex.
1. I have a global variable that stores an employee number
2. I want to select an SSN # from a table based on an employee #
variable.
select ssn from emp where ssn = :input_variable - ????
- how do i reference the variable - I am getting a 'missing IN or OUT parameter error?
Any advice is much appreciated.
~Thanks
I'm just wondering if anyone knows a work around so that I might be able to store a Table's FIELD name in a variable or an array[] so that I can do a query based on the decision of a loop without having to code 10 IF/ELSE statements.For instance, although the above code will not work, this code, although quite lengthy, does:
If DataGrid1.SelStartCol = 0 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES__PUR_DT"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 1 Then
Adodc1.RecordSource = "Select * from tblReservation order by VENDOR"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 2 Then
Adodc1.RecordSource = "Select * from tblReservation order by VEN_LOC"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 3 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_TYPE"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 4 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_FROM_DT"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 5 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_TO_DT"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 6 Then
Adodc1.RecordSource = "Select * from tblReservation order by MISC_ADJ"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 7 Then
Adodc1.RecordSource = "Select * from tblReservation order by STATE_TAX"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 8 Then
Adodc1.RecordSource = "Select * from tblReservation order by LOC_CHARGE"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 9 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_ID"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 10 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_OP"
Adodc1.Refresh
End If
Do you see where i'm going with this?
I simple want to use a variable in the "select * from <Table> Order by <Field>"
Similar Messages
-
[php+mysql] how to use variables in a select statement?
Hi all,
I'm searching for a way to use a variable in the select
statement of mysql
query.
I have this variable that can contain:
$var=field_1 field_2 field5
or
$var=field3 field4 field8
so, the variable content is not always the same.
I would like to filter a table selecting only the columns
specified by the
current $var content.
Is this possible to do something like this?
$var=field1 field5 field10
SELECT string_to_array($var)
FROM mytable
ORDER BY mysortfield ASC
Or, is there another way to select columns dynamically?
Thanks for any suggestion.
tonyHi all,
I'm searching for a way to use a variable in the select
statement of mysql
query.
I have this variable that can contain:
$var=field_1 field_2 field5
or
$var=field3 field4 field8
so, the variable content is not always the same.
I would like to filter a table selecting only the columns
specified by the
current $var content.
Is this possible to do something like this?
$var=field1 field5 field10
SELECT string_to_array($var)
FROM mytable
ORDER BY mysortfield ASC
Or, is there another way to select columns dynamically?
Thanks for any suggestion.
tony -
Using variables in the Select statement
Here is my Select statement:
Set EmpDynaset = OraDatabase.CreateDynaset("select CU_NAME,CU_CONTACT from CU where CU_Name =" & cnt, 0&)
What's wrong with this? I'm trying to use the variable cnt. Any help? Thanks, JeremyHere is my Select statement:
Set EmpDynaset = OraDatabase.CreateDynaset("select CU_NAME,CU_CONTACT from CU where CU_Name =" & cnt, 0&)
What's wrong with this? I'm trying to use the variable cnt. Any help? Thanks, Jeremy Perhaps using the following:
("select CU_NAME,CU_CONTACT from CU where CU_Name = :variable")
then binding the variable to a value before executing the statement.. -
How to use bind variable in this select statement
Hi,
I have created this procedure where table name and fieldname is variable as they vary, therefore i passed them as parameter. This procedure will trim leading (.) if first five char is '.THE''. The procedure performs the required task. I want to make select statement with bind variable is there any possibility to use a bind variable in this select statement.
the procedure is given below:
create or replace procedure test(tablename in varchar2, fieldname IN varchar2)
authid current_user
is
type poicurtype is ref cursor;
poi_cur poicurtype;
sqlst varchar2(250);
THEVALUE NUMBER;
begin
sqlst:='SELECT EMPNO FROM '||TABLENAME||' WHERE SUBSTR('||FIELDNAME||',1,5)=''.THE ''';
DBMS_OUTPUT.PUT_LINE(SQLST);
OPEN POI_CUR FOR SQLST ;
LOOP
FETCH POI_CUR INTO THEVALUE;
EXIT WHEN POI_CUR%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(THEVALUE);
SQLST:='UPDATE '||TABLENAME|| ' SET '||FIELDNAME||'=LTRIM('||FIELDNAME||',''.'')';
SQLST:=SQLST|| ' WHERE EMPNO=:X';
DBMS_OUTPUT.PUT_LINE(SQLST);
EXECUTE IMMEDIATE SQLST USING THEVALUE;
END LOOP;
COMMIT;
END TEST;
Best Regards,So you want to amend each row individually? Is there some reason you're trying to make this procedure run as slow as possible?
create or replace procedure test (tablename in varchar2, fieldname in varchar2)
authid current_user
is
sqlst varchar2 (250);
thevalue number := 1234;
begin
sqlst := 'update ' || tablename || ' set ' || fieldname || '= ltrim(' || fieldname || ',''.'') where substr(' || fieldname
|| ',1,5) = ''.THE ''';
dbms_output.put_line (sqlst);
execute immediate sqlst;
end test;will update every row that satisfies the criteria in a single statement. If there are 10 rows that start with '.THE ' then it will update 10 rows. -
Use variables in a SELECT INTO FROM command
Hi,
How do I use variables within a select into from command? I want to loop through SYS.DBA_TABLES using a cursor and count the number of rows in a
selection of tables an then insert into a cardinality table.
The count of rows will be stored in a variable called CNT, that bit is easy however I need a variable in the FROM clause because that
value changes with every iteration of the cursor.
e.g.
CNT := 0;
TN := "MyTable";
select count(*) into CNT FROM TN;
insert into cardinality (table_name, row_count) values (TN, CNT);
This is Oracle 9i and I need the row counts in a separate table as they are shipped over to a different environment for analysis purposes.
Any ideas?
Regards
Dave
Edited by: Yorky001 on Sep 15, 2010 10:32 AMHi,
Thanks for the info, unfortunately I can get neither example to work on this 9i system, could well be pilot error as I only ever get
to do any Oracle about once per year. In the first query I have tried both "user_tables" and SYS.DBA_TABLES, same result.
set serveroutput on size 1000000;
DECLARE
row_count INTEGER;
vstr VARCHAR2(500);
vstr1 VARCHAR2(500);
BEGIN
vstr := 'SELECT count(*) FROM ';
dbms_output.put_line(vstr);
FOR i IN (SELECT table_name FROM user_tables WHERE rownum < 10) LOOP
vstr1 := vstr || i.table_name;
EXECUTE IMMEDIATE vstr1
INTO row_count;
dbms_output.put_line(i.table_name || ':' || row_count);
END LOOP;
END;
This one complains about the execute immediate line.
Error report:
ORA-00933: SQL command not properly ended
ORA-06512: at line 12
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
BEGIN
FOR i IN (select
table_name,
to_number(
extractvalue(
xmltype(
dbms_xmlgen.getxml('select count(*) c from '||table_name))
,'/ROWSET/ROW/C')) count
from user_tables
where rownum<6) LOOP
dbms_output.put_line(i.table_name || ':' || i.count);
END LOOP;
END;
ORA-19206: Invalid value for query or REF CURSOR parameter
ORA-06512: at "SYS.DBMS_XMLGEN", line 121
ORA-06512: at line 1
ORA-06512: at line 2
19206. 00000 - "Invalid value for query or REF CURSOR parameter"
*Cause: The queryString argument passed to DBMS_XMLGEN.newContext was not a valid query, or REF CURSOR.
*Action: Rewrite the query so that the queryString argument is a valid query or REF CURSOR. -
Timesten create a lock for select statement through sqldev
When use ttisql connect to TimesTen Release 7.0.6.15.0 at autocommit=1, there is no lock for select statement.
but when I use sql developer (driver is ttjdbc5.jar, regardless of version) to connect, even with autocommit=1, there will be locks for select statement.
Is it a bug? How can I achieve the same no locks for select statement through sql developer?Thanks.-your update tells me that you are connected to a remote timesten data store using the client driver
-the ttXactAdmin output indicates that SqlNavigator has a shared lock on the database itself: this will not interfere with anybody else' read operations, and I believe that until such time as you actually attempt some kind of DML against the data store that th IX lock on the database lock will not interfere with any other DML either.
-a shared database lock will always be acquired for any transaction in TimesTen. You can test this for yourself from ttisql: set autocommit off, perform a simple update and do not commit the transaction. Then open a separate session and execute ttxactadmin - you will the IX database lock as well as the various locks on tables and indexes.
-I believe this pretty much proves my original thinking: that sqlDeveloper attaches to TimesTen in transaction mode. However, the IX lock on the database will not interfere with anybody else's work and should not be a problem. -
How to use SET ID in select statement of SQ02
Hi,
I have a infoset, where for one of my Zfield, i have writen a select statement in order to get my ouput.
if aufk-aufnr = 'XYZ'.
select sum( FKBTR ) from fmifiit into zfmifiit
where fikrs = aufk-kokrs
and fipex IN capex
and wrttp NE '51'.
endif.
For the above statement, i have created (with 10 single values, table name FMCI, field name FIPEX) a SET id named CAPEX and used with IN operator.
But when i generating the infoset i am getting error like below
The IN operator with "CAPEX" is followed neither by an internal table nor by a value list
I was using IN opeartor for set ids during validation / substitutions, where if i have to validate multiple single values.
What to do here?
Regards,
Srinu[OPEN-SQL|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_GENERAL.htm] set of statement, [SELECT|http://help.sap.com/abapdocu_70/en/ABAPWHERE.htm] statement, [WHERE|http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP.htm] addition requires a selection table (type range, [WHERE - IN seltab |http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_SELTAB.htm]) of parameter and not a set. We are in Abap here, not in a Customizing screen
You have to convert the set to a selection table in an ABAP coding before using it in a SELECT statement.
(Check FM like G_SET_TREE_IMPORT to import definition of set (values and intervals) and map them to a select-table, or ask a developper to perform it, look at G_SET_TREE_IMPORT -> select statement)
Regards,
Raymond -
Using plsql tables in select statement of report query
Hi
Anyone have experience to use plsql table to select statement to create a report. In otherwords, How to run report using flat file (xx.txt) information like 10 records in flat files and use this 10 records to the report and run pdf files.
thanks in advance
sureshhi,
u can use the utl_file package to do that using a ref cursor query in the data model and u can have this code to read data from a flat file
declare
ur_file utl_file.file_type;
my_result varchar2(250);
begin
ur_file := UTL_FILE.FOPEN ('&directory', '&filename', 'r') ;
utl_file.get_line(ur_file, my_result);
dbms_output.put_line(my_result);
utl_file.fclose(ur_file);
end;
make sure u have an entry in ur init.ora saying that your
utl_file_dir = '\your directory where ur files reside'
cheers!
[email protected] -
Using java function in select statement
Hi,
I am trying to use java function in select statement.
public class ClassA{
private static String MyConst = "foo";
public static String functionA(){
return MyConst;
in my query I have:
select
ClassA.functionA() AS id,
groupId AS newID,
from
myChannel[now]
ClassA is part of the application (no need to import).
I get and error of Invalid Expression on ClassA.functionA().
I also tried to declare the function in the processor element:
<wlevs:processor id="proc">
<wlevs:function function-name="A" exec-methode="functionA">
<bean class="mtPackage.ClassA"/>
</wlevs:function>
<wlevs:processor>
but then I get a different error in the processor XML file: "An InvocationTargetException was encoutered while attemting to register the user defind function A. The message was null"
What am I missing here?Hi,
From the above description, you have tried two manners to call method functionA() in the user defined class ClassA. One uses java cartridge manner directly and the other try to use user defined function manner.
For the java cartridge manner, the following CQL query should work if the ClassA is really included in the OEP app. I have done similar test before, it works.
select
ClassA.functionA() AS id,
groupId AS newID,
from
myChannel[now]
For user defined function manner, I think two things you need to change:
1. Need to declare the function in the EPN assembly file(under META-INF/spring/), not component configuration file(under META-INF/wlevs/). The following is an example:
<wlevs:processor id="proc">
<wlevs:function function-name="A" exec-methode="functionA">
<bean class="mtPackage.ClassA"/>
</wlevs:function>
</wlevs:processor>
2. Call the user defined function in the CQL query in the component configuration file under processor. For example:
select A() from myChannel
Regards,
XiYing -
Using Variables in a SQL Statement
I know, I know, this is written in VB..I'm doing a VB Project right now for my Instructor (While in an Intermediate Java Class)
But VB (I feel) doesnt have very good support Forums.
Anyway, this is the problem:
I want to use String Variables to hold the place of field names in
a SQL Statement and the change the ORDER according to intCount's Loop:
The key word(s) here is "ORDER BY"
Private Sub DataGrid1_Click()
Dim intCount As Integer
Dim strColHead(11) As String
strColHead(0) = "RES__PUR_DT"
strColHead(1) = "VENDOR"
strColHead(2) = "VEN_LOC"
strColHead(3) = "RES_TYPE"
strColHead(4) = "RES_FROM_DT"
strColHead(5) = "RES_TO_DT"
strColHead(6) = "MISC_ADJ"
strColHead(7) = "STATE_TAX"
strColHead(8) = "LOC_CHARGE"
strColHead(9) = "RES_ID"
strColHead(10) = "RES_OP"
For intCount = 0 To 10
If DataGrid1.SelStartCol = intCount Then
Adodc1.RecordSource = "Select * from tblReservation order by 'strColHead(intCount)'"
End If
Adodc1.Refresh
Next intCount
End SubI'm just wondering if anyone knows a work around so that I might be able to store a Table's FIELD name in a variable or an array[] so that I can do a query based on the decision of a loop without having to code 10 IF/ELSE statements.For instance, although the above code will not work, this code, although quite lengthy, does:
If DataGrid1.SelStartCol = 0 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES__PUR_DT"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 1 Then
Adodc1.RecordSource = "Select * from tblReservation order by VENDOR"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 2 Then
Adodc1.RecordSource = "Select * from tblReservation order by VEN_LOC"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 3 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_TYPE"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 4 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_FROM_DT"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 5 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_TO_DT"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 6 Then
Adodc1.RecordSource = "Select * from tblReservation order by MISC_ADJ"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 7 Then
Adodc1.RecordSource = "Select * from tblReservation order by STATE_TAX"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 8 Then
Adodc1.RecordSource = "Select * from tblReservation order by LOC_CHARGE"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 9 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_ID"
Adodc1.Refresh
ElseIf DataGrid1.SelStartCol = 10 Then
Adodc1.RecordSource = "Select * from tblReservation order by RES_OP"
Adodc1.Refresh
End If
Do you see where i'm going with this?
I simple want to use a variable in the "select * from <Table> Order by <Field>" -
Help! Crashing JVM while doing SELECT statement through JDBC-ODBC bridge
Hi everyone,
Help please. I am working on a project on my own computer using the jdk version 1.5.0_04.
The project involves running a select on a Microsoft Access 2003 database via the JDBC-ODBC bridge. The database is registered in the ODBC database sources, and it works fine in those other projects.
Yet, when I'm running similar code in this project, it crashes the Java Virtual Machine. I get the following in a log file:
# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c901010, pid=2308, tid=1364
# Java VM: Java HotSpot(TM) Client VM (1.5.0_04-b05 mixed mode, sharing)
# Problematic frame:
# C [ntdll.dll+0x1010]
--------------- T H R E A D ---------------
Current thread (0x000360f8): JavaThread "main" [_thread_in_native, id=1364]
siginfo: ExceptionCode=0xc0000005, reading address 0x00000018
Registers:
EAX=0x00000004, EBX=0x26bb5250, ECX=0x7ffde000, EDX=0x00000004
ESP=0x0007f8d8, EBP=0x0007f8f0, ESI=0x00000000, EDI=0x02ea1590
EIP=0x7c901010, EFLAGS=0x00010246
Top of Stack: (sp=0x0007f8d8)
0x0007f8d8: 74355a16 00000004 02ea15b4 7432139f
0x0007f8e8: 02ea15b4 02ea1590 0007f900 74322c5d
0x0007f8f8: 02ea15b4 000361b4 0007f914 74325fa0
0x0007f908: 02ea1590 74350000 00390000 0007f930
0x0007f918: 7432740e 02ea1590 0007f950 00000003
0x0007f928: 00aabe20 000361b4 0007f948 6d3e11da
0x0007f938: 02ea1590 0007f950 000360f8 26bb5250
0x0007f948: 0007f980 00ad826f 00000000 0007f99c
Instructions: (pc=0x7c901010)
0x7c901000: 90 90 90 90 90 64 8b 0d 18 00 00 00 8b 54 24 04
0x7c901010: 83 7a 14 00 75 4f f0 ff 42 04 75 19 8b 41 24 89
Stack: [0x00040000,0x00080000), sp=0x0007f8d8, free space=254k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [ntdll.dll+0x1010]
C [ODBC32.dll+0x2c5d]
C [ODBC32.dll+0x5fa0]
C [ODBC32.dll+0x740e]
C [JdbcOdbc.dll+0x11da]
j sun.jdbc.odbc.JdbcOdbc.allocStmt(J[B)J+0
j sun.jdbc.odbc.JdbcOdbc.SQLAllocStmt(J)J+47
j sun.jdbc.odbc.JdbcOdbcConnection.createStatement(II)Ljava/sql/Statement;+27
j sun.jdbc.odbc.JdbcOdbcConnection.createStatement()Ljava/sql/Statement;+7
j LUDatabaseWorker.getBoxScoreFromDB(LStatisticalItems/BoxScore;)LStatisticalItems/BoxScore;+215
j NewUSCHOLiveUpdate.processTheBoxScores()V+78
j NewUSCHOLiveUpdate.main([Ljava/lang/String;)V+9
v ~StubRoutines::call_stub
V [jvm.dll+0x82696]
V [jvm.dll+0xd6fd9]
V [jvm.dll+0x82567]
V [jvm.dll+0x895e6]
C [java.exe+0x14c0]
C [java.exe+0x64cd]
C [kernel32.dll+0x16d4f]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j sun.jdbc.odbc.JdbcOdbc.allocStmt(J[B)J+0
j sun.jdbc.odbc.JdbcOdbc.SQLAllocStmt(J)J+47
j sun.jdbc.odbc.JdbcOdbcConnection.createStatement(II)Ljava/sql/Statement;+27
j sun.jdbc.odbc.JdbcOdbcConnection.createStatement()Ljava/sql/Statement;+7
j LUDatabaseWorker.getBoxScoreFromDB(LStatisticalItems/BoxScore;)LStatisticalItems/BoxScore;+215
j NewUSCHOLiveUpdate.processTheBoxScores()V+78
j NewUSCHOLiveUpdate.main([Ljava/lang/String;)V+9
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x00a6e550 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2240]
0x00a6d258 JavaThread "CompilerThread0" daemon [_thread_blocked, id=736]
0x00a6c440 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2252]
0x00a47808 JavaThread "Finalizer" daemon [_thread_blocked, id=3352]
0x00a46328 JavaThread "Reference Handler" daemon [_thread_blocked, id=1560]
=>0x000360f8 JavaThread "main" [_thread_in_native, id=1364]
Other Threads:
0x00a67a68 VMThread [id=2700]
0x00a6f8c8 WatcherThread [id=2480]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 576K, used 404K [0x22b90000, 0x22c30000, 0x23070000)
eden space 512K, 70% used [0x22b90000, 0x22bea738, 0x22c10000)
from space 64K, 66% used [0x22c20000, 0x22c2a990, 0x22c30000)
to space 64K, 0% used [0x22c10000, 0x22c10000, 0x22c20000)
tenured generation total 1408K, used 846K [0x23070000, 0x231d0000, 0x26b90000)
the space 1408K, 60% used [0x23070000, 0x231438e0, 0x23143a00, 0x231d0000)
compacting perm gen total 8192K, used 507K [0x26b90000, 0x27390000, 0x2ab90000)
the space 8192K, 6% used [0x26b90000, 0x26c0ed38, 0x26c0ee00, 0x27390000)
ro space 8192K, 66% used [0x2ab90000, 0x2b0e9dc0, 0x2b0e9e00, 0x2b390000)
rw space 12288K, 46% used [0x2b390000, 0x2b927e98, 0x2b928000, 0x2bf90000)
Dynamic libraries:
0x00400000 - 0x0040c000 C:\jdk1.5.0_04\bin\java.exe
0x7c900000 - 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f4000 C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f01000 C:\WINDOWS\system32\RPCRT4.dll
0x77c10000 - 0x77c68000 C:\WINDOWS\system32\MSVCRT.dll
0x6d6b0000 - 0x6d839000 C:\jdk1.5.0_04\jre\bin\client\jvm.dll
0x77d40000 - 0x77dd0000 C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f56000 C:\WINDOWS\system32\GDI32.dll
0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
0x629c0000 - 0x629c9000 C:\WINDOWS\system32\LPK.DLL
0x74d90000 - 0x74dfb000 C:\WINDOWS\system32\USP10.dll
0x6d2f0000 - 0x6d2f8000 C:\jdk1.5.0_04\jre\bin\hpi.dll
0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
0x6d680000 - 0x6d68c000 C:\jdk1.5.0_04\jre\bin\verify.dll
0x6d370000 - 0x6d38d000 C:\jdk1.5.0_04\jre\bin\java.dll
0x6d6a0000 - 0x6d6af000 C:\jdk1.5.0_04\jre\bin\zip.dll
0x6d3e0000 - 0x6d3ed000 C:\jdk1.5.0_04\jre\bin\JdbcOdbc.dll
0x74320000 - 0x7435d000 C:\WINDOWS\system32\ODBC32.dll
0x5d090000 - 0x5d127000 C:\WINDOWS\system32\COMCTL32.dll
0x7c9c0000 - 0x7d1d5000 C:\WINDOWS\system32\SHELL32.dll
0x77f60000 - 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll
0x763b0000 - 0x763f9000 C:\WINDOWS\system32\comdlg32.dll
0x773d0000 - 0x774d2000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll
0x20000000 - 0x20017000 C:\WINDOWS\system32\odbcint.dll
0x774e0000 - 0x7761d000 C:\WINDOWS\system32\ole32.dll
0x77120000 - 0x771ac000 C:\WINDOWS\system32\OLEAUT32.dll
0x77fe0000 - 0x77ff1000 C:\WINDOWS\system32\Secur32.dll
0x76fd0000 - 0x7704f000 C:\WINDOWS\system32\CLBCATQ.DLL
0x77050000 - 0x77115000 C:\WINDOWS\system32\COMRes.dll
0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll
0x0f9a0000 - 0x0f9ab000 C:\WINDOWS\system32\VBAJET32.DLL
0x5ad70000 - 0x5ada8000 C:\WINDOWS\system32\uxtheme.dll
VM Arguments:
java_command: NewUSCHOLiveUpdate
Environment Variables:
JAVA_HOME=C:\jdk1.5.0_04
CLASSPATH=C:\jdk1.5.0_04\bin\NewLiveUpdate;C:\jdk1.5.0_04\bin\NewLiveUpdate\StatisticalItems;C:\jdk1.5.0_04\bin\NewLiveUpdate\Exceptions;C:\jdk1.5.0_04\bin\NewLiveUpdate\Helper;
PATH=C:\jdk1.5.0_04\bin;C:\JavaTools\ant\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;;c:\program files\devstudio\sharedide\bin\ide;c:\program files\devstudio\sharedide\bin;c:\program files\devstudio\vc\bin
USERNAME=Kevin Yetman
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 3, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 2 family 15, cmov, cx8, fxsr, mmx, sse, sse2, ht
Memory: 4k page, physical 1047020k(627436k free), swap 2518436k(2161900k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_04-b05) for windows-x86, built on Jun 3 2005 02:10:41 by "java_re" with MS VC++ 6.0
The code that is causing the problem is in the class shown below. It is in the method getBoxScoreFromDB. When it attempts to run the first select statement, it causes the crash that I showed above.
The connection is set up by the calling class. The calling class constructs a LUDatabaseWorker, sets the necessary parameters (dbURL, driver class, username and password), and calls the openDBConnection().
// LUDatabaseWorker.java
import StatisticalItems.*;
import java.sql.*;
import java.util.*;
public class LUDatabaseWorker
private StatisticalItems.BoxScore m_CurrentBoxScoreInDB;
private Connection m_Connection;
private String m_dbURL;
private String m_dbUsername;
private String m_dbPassword;
private String m_dbDriverClass;
public LUDatabaseWorker()
public StatisticalItems.BoxScore getCurrentBoxScoreInDB()
{ return m_CurrentBoxScoreInDB;
public void setDBURL(String dbURL)
{ m_dbURL=new String(dbURL);
public void setDBUsername(String dbUsername)
{ m_dbUsername=new String(dbUsername);
public void setDBPassword(String dbPassword)
{ m_dbPassword=new String(dbPassword);
public void setDBDriverClass(String dbDriverClass)
{ m_dbDriverClass=new String(dbDriverClass);
public void openDBConnection()
throws SQLException, ClassNotFoundException
Class.forName(m_dbDriverClass);
m_Connection=DriverManager.getConnection(m_dbURL, m_dbUsername, m_dbPassword);
public void closeDBConnection()
throws SQLException
m_Connection.close();
public Hashtable<String, Integer> getUSCHOCodeToMyTeamIndexMap()
throws SQLException
Hashtable<String, Integer> ht=new Hashtable<String, Integer>();
String sqlQuery="SELECT TeamIndex, TeamCode FROM TeamLiveUpdateUSCHO";
Statement st=m_Connection.createStatement();
ResultSet rs=st.executeQuery(sqlQuery);
while(rs.next())
String uschoCode=new String(rs.getString(2));
Integer myTeamIndex=new Integer(rs.getInt(1));
ht.put(uschoCode, myTeamIndex);
rs.close();
st.close();
return ht;
public StatisticalItems.BoxScore getBoxScoreFromDB(StatisticalItems.BoxScore luBoxScore)
throws SQLException
StatisticalItems.BoxScore boxScoreFromDB=new StatisticalItems.BoxScore();
// get the basic game info from the live update box score.
StatisticalItems.Game luBasicGameData=luBoxScore.getBasicGameData();
// get the basic game data.
String sqlQuery="SELECT * FROM Game WHERE (Year=" + luBasicGameData.getYear() + ") AND (Month='";
if( luBasicGameData.getMonth() < 10 )
{ sqlQuery+="0";
sqlQuery+=luBasicGameData.getMonth() + "') AND (Day='";
if( luBasicGameData.getDay() < 10 )
{ sqlQuery+="0";
sqlQuery+=luBasicGameData.getDay() + "') AND (HomeTeamIndex=" + luBasicGameData.getHomeTeamIndex();
sqlQuery+=") AND (VisitorTeamIndex=" + luBasicGameData.getVisitorTeamIndex() + ")";
System.out.println(sqlQuery);
Statement st=m_Connection.createStatement();
ResultSet rs=st.executeQuery(sqlQuery);
if( rs.next() )
StatisticalItems.Game dbGame=boxScoreFromDB.getBasicGameData();
dbGame.setGameIndex(rs.getInt("GameIndex"));
dbGame.setHomeTeamIndex(rs.getInt("HomeTeamIndex"));
dbGame.setVisitorTeamIndex(rs.getInt("VisitorTeamIndex"));
dbGame.setHomeTeamGoals(rs.getInt("HomeTeamGoals"));
dbGame.setVisitorTeamGoals(rs.getInt("VisitorTeamGoals"));
dbGame.setHomeTeamScoredFirst(rs.getString("HomeTeamScoredFirst"));
dbGame.setYear(rs.getInt("Year"));
dbGame.setMonth(rs.getInt("Month"));
dbGame.setDay(rs.getInt("Day"));
dbGame.setLeagueGame(rs.getBoolean("LeagueGame"));
dbGame.setNeutralSiteGame(rs.getBoolean("NeutralSiteGame"));
dbGame.setForfeitHome(rs.getBoolean("ForfeitHome"));
dbGame.setForfeitVisitor(rs.getBoolean("ForfeitVisitor"));
dbGame.setPlayoffGame(rs.getBoolean("PlayoffGame"));
boxScoreFromDB.setBasicGameData(dbGame);
StatisticalItems.Game dbGame=boxScoreFromDB.getBasicGameData();
// get the home team goals per period.
sqlQuery="SELECT * FROM GameDetailGoalsPerPeriod WHERE (GameIndex=" + dbGame.getGameIndex() + ") AND ";
sqlQuery+="(TeamIndex=" + dbGame.getHomeTeamIndex() + ")";
rs=st.executeQuery(sqlQuery);
if( rs.next() )
StatisticalItems.GameDetailGoalsPerPeriod dbHomeGPP=boxScoreFromDB.getHomeTeamGoalsPerPeriod();
dbHomeGPP.setGameDetailGoalsPerPeriodIndex(rs.getInt("GameDetailGoalsPerPeriodIndex"));
dbHomeGPP.setGameIndex(rs.getInt("GameIndex"));
dbHomeGPP.setTeamIndex(rs.getInt("TeamIndex"));
dbHomeGPP.setPeriod1(new Integer(rs.getInt("GoalsFirstPeriod")));
dbHomeGPP.setPeriod2(new Integer(rs.getInt("GoalsSecondPeriod")));
dbHomeGPP.setPeriod3(new Integer(rs.getInt("GoalsThidPeriod")));
dbHomeGPP.setOvertime(new Integer(rs.getInt("GoalsOvertime")));
dbHomeGPP.setEmptyNetGoals(rs.getInt("EmptyNetGoals"));
dbHomeGPP.setFoundInDatabase(true);
boxScoreFromDB.setHomeTeamGoalsPerPeriod(dbHomeGPP);
// get the visitor team goals per period.
sqlQuery="SELECT * FROM GameDetailGoalsPerPeriod WHERE (GameIndex=" + dbGame.getGameIndex() + ") AND ";
sqlQuery+="(TeamIndex=" + dbGame.getVisitorTeamIndex() + ")";
rs=st.executeQuery(sqlQuery);
if( rs.next() )
StatisticalItems.GameDetailGoalsPerPeriod dbVisitorGPP=boxScoreFromDB.getVisitorTeamGoalsPerPeriod();
dbVisitorGPP.setGameDetailGoalsPerPeriodIndex(rs.getInt("GameDetailGoalsPerPeriodIndex"));
dbVisitorGPP.setGameIndex(rs.getInt("GameIndex"));
dbVisitorGPP.setTeamIndex(rs.getInt("TeamIndex"));
dbVisitorGPP.setPeriod1(new Integer(rs.getInt("GoalsFirstPeriod")));
dbVisitorGPP.setPeriod2(new Integer(rs.getInt("GoalsSecondPeriod")));
dbVisitorGPP.setPeriod3(new Integer(rs.getInt("GoalsThidPeriod")));
dbVisitorGPP.setOvertime(new Integer(rs.getInt("GoalsOvertime")));
dbVisitorGPP.setEmptyNetGoals(rs.getInt("EmptyNetGoals"));
dbVisitorGPP.setFoundInDatabase(true);
boxScoreFromDB.setVisitorTeamGoalsPerPeriod(dbVisitorGPP);
// get the home team shots per period.
sqlQuery="SELECT * FROM GameDetailShotsPerPeriod WHERE (GameIndex=" + dbGame.getGameIndex() + ") AND ";
sqlQuery+="(TeamIndex=" + dbGame.getHomeTeamIndex() + ")";
rs=st.executeQuery(sqlQuery);
if( rs.next() )
StatisticalItems.GameDetailShotsPerPeriod dbHomeSPP=boxScoreFromDB.getHomeTeamShotsPerPeriod();
dbHomeSPP.setGameDetailShotsPerPeriodIndex(rs.getInt("GameDetailShotsPerPeriodIndex"));
dbHomeSPP.setGameIndex(rs.getInt("GameIndex"));
dbHomeSPP.setTeamIndex(rs.getInt("TeamIndex"));
dbHomeSPP.setPeriod1(new Integer(rs.getInt("ShotsFirstPeriod")));
dbHomeSPP.setPeriod2(new Integer(rs.getInt("ShotsSecondPeriod")));
dbHomeSPP.setPeriod3(new Integer(rs.getInt("ShotsThidPeriod")));
dbHomeSPP.setOvertime(new Integer(rs.getInt("ShotsOvertime")));
dbHomeSPP.setFoundInDatabase(true);
boxScoreFromDB.setHomeTeamShotsPerPeriod(dbHomeSPP);
// get the visitor team shots per period.
sqlQuery="SELECT * FROM GameDetailShotsPerPeriod WHERE (GameIndex=" + dbGame.getGameIndex() + ") AND ";
sqlQuery+="(TeamIndex=" + dbGame.getVisitorTeamIndex() + ")";
rs=st.executeQuery(sqlQuery);
if( rs.next() )
StatisticalItems.GameDetailShotsPerPeriod dbVisitorSPP=boxScoreFromDB.getVisitorTeamShotsPerPeriod();
dbVisitorSPP.setGameDetailShotsPerPeriodIndex(rs.getInt("GameDetailShotsPerPeriodIndex"));
dbVisitorSPP.setGameIndex(rs.getInt("GameIndex"));
dbVisitorSPP.setTeamIndex(rs.getInt("TeamIndex"));
dbVisitorSPP.setPeriod1(new Integer(rs.getInt("ShotsFirstPeriod")));
dbVisitorSPP.setPeriod2(new Integer(rs.getInt("ShotsSecondPeriod")));
dbVisitorSPP.setPeriod3(new Integer(rs.getInt("ShotsThidPeriod")));
dbVisitorSPP.setOvertime(new Integer(rs.getInt("ShotsOvertime")));
dbVisitorSPP.setFoundInDatabase(true);
boxScoreFromDB.setVisitorTeamShotsPerPeriod(dbVisitorSPP);
// get the home team special teams.
sqlQuery="SELECT * FROM GameDetailSpecialTeams WHERE (GameIndex=" + dbGame.getGameIndex() + ") AND ";
sqlQuery+="(TeamIndex=" + dbGame.getHomeTeamIndex() + ")";
rs=st.executeQuery(sqlQuery);
if( rs.next() )
StatisticalItems.GameDetailSpecialTeams dbHomeST=boxScoreFromDB.getHomeTeamSpecialTeams();
dbHomeST.setGameDetailSpecialTeamsIndex(rs.getInt("GameDetailSpecialTeamsIndex"));
dbHomeST.setGameIndex(rs.getInt("GameIndex"));
dbHomeST.setTeamIndex(rs.getInt("TeamIndex"));
dbHomeST.setPowerplayGoals(rs.getInt("PowerPlayGoals"));
dbHomeST.setShorthandedGoals(rs.getInt("ShortHandedGoals"));
dbHomeST.setPowerplayOps(rs.getInt("PowerPlayOps"));
dbHomeST.setShorthandedOps(rs.getInt("ShortHandedOps"));
dbHomeST.setPenalties(rs.getInt("Penalties"));
dbHomeST.setPenaltyMinutes(rs.getInt("PenaltyMinutes"));
dbHomeST.setFoundInDatabase(true);
boxScoreFromDB.setHomeTeamSpecialTeams(dbHomeST);
// get the home team special teams.
sqlQuery="SELECT * FROM GameDetailSpecialTeams WHERE (GameIndex=" + dbGame.getGameIndex() + ") AND ";
sqlQuery+="(TeamIndex=" + dbGame.getVisitorTeamIndex() + ")";
rs=st.executeQuery(sqlQuery);
if( rs.next() )
StatisticalItems.GameDetailSpecialTeams dbVisitorST=boxScoreFromDB.getVisitorTeamSpecialTeams();
dbVisitorST.setGameDetailSpecialTeamsIndex(rs.getInt("GameDetailSpecialTeamsIndex"));
dbVisitorST.setGameIndex(rs.getInt("GameIndex"));
dbVisitorST.setTeamIndex(rs.getInt("TeamIndex"));
dbVisitorST.setPowerplayGoals(rs.getInt("PowerPlayGoals"));
dbVisitorST.setShorthandedGoals(rs.getInt("ShortHandedGoals"));
dbVisitorST.setPowerplayOps(rs.getInt("PowerPlayOps"));
dbVisitorST.setShorthandedOps(rs.getInt("ShortHandedOps"));
dbVisitorST.setPenalties(rs.getInt("Penalties"));
dbVisitorST.setPenaltyMinutes(rs.getInt("PenaltyMinutes"));
dbVisitorST.setFoundInDatabase(true);
boxScoreFromDB.setVisitorTeamSpecialTeams(dbVisitorST);
rs.close();
st.close();
return boxScoreFromDB;
public void updateBoxScoreInDB(StatisticalItems.BoxScore dbBoxScore,
StatisticalItems.BoxScore luBoxScore,
LUBoxScoreComparator bsc)
throws SQLException
if( bsc.getGameChanged() )
updateGameInDB(dbBoxScore, luBoxScore);
if( bsc.getHomeGoalsPerPeriodChanged() )
updateHomeGoalsPerPeriod(dbBoxScore, luBoxScore);
if( bsc.getVisitorGoalsPerPeriodChanged() )
updateVisitorGoalsPerPeriod(dbBoxScore, luBoxScore);
if( bsc.getHomeShotsPerPeriodChanged() )
updateHomeShotsPerPeriod(dbBoxScore, luBoxScore);
if( bsc.getVisitorShotsPerPeriodChanged() )
updateVisitorShotsPerPeriod(dbBoxScore, luBoxScore);
if( bsc.getHomeSpecialTeamsChanged() )
updateHomeSpecialTeams(dbBoxScore, luBoxScore);
if( bsc.getVisitorSpecialTeamsChanged() )
updateVisitorSpecialTeams(dbBoxScore, luBoxScore);
protected void updateGameInDB(StatisticalItems.BoxScore dbBoxScore,
StatisticalItems.BoxScore luBoxScore)
throws SQLException
// the only fields that NEED to be updated are HomeTeamGoals, VisitorTeamGoals, HomeTeamScoredFirst,
// and LeagueGame. You can't determine from the LU box Score:
// Forfeits, NeutralSite, or Playoff.
// the GameIndex, Both team indexes, and the game date will NEVER change from the database.
Statement st=m_Connection.createStatement();
String sqlStmt="UPDATE Game SET ";
sqlStmt+="HomeTeamGoals=" + luBoxScore.getBasicGameData().getHomeTeamGoals() + ", ";
sqlStmt+="VisitorTeamGoals=" + luBoxScore.getBasicGameData().getVisitorTeamGoals() + ", ";
sqlStmt+="HomeTeamScoredFirst='" + luBoxScore.getBasicGameData().getHomeTeamScoredFirst() + "', ";
sqlStmt+="LeagueGame=" + luBoxScore.getBasicGameData().getLeagueGame() + " ";
sqlStmt+="WHERE GameIndex=" + dbBoxScore.getBasicGameData().getGameIndex();
st.executeUpdate(sqlStmt);
st.close();
protected void updateHomeGoalsPerPeriod(StatisticalItems.BoxScore dbBoxScore,
StatisticalItems.BoxScore luBoxScore)
throws SQLException
Statement st=m_Connection.createStatement();
String sqlStmt="";
if( dbBoxScore.getHomeTeamGoalsPerPeriod().getFoundInDatabase() )
sqlStmt="UPDATE GameDetailGoalsPerPeriod SET ";
sqlStmt+="GameIndex=" + dbBoxScore.getHomeTeamGoalsPerPeriod().getGameIndex() + ", ";
sqlStmt+="TeamIndex=" + luBoxScore.getHomeTeamGoalsPerPeriod().getTeamIndex() + ", ";
sqlStmt+="GoalsFirstPeriod=" + luBoxScore.getHomeTeamGoalsPerPeriod().getPeriod1() + ", ";
sqlStmt+="GoalsSecondPeriod=" + luBoxScore.getHomeTeamGoalsPerPeriod().getPeriod2() + ", ";
sqlStmt+="GoalsThirdPeriod=" + luBoxScore.getHomeTeamGoalsPerPeriod().getPeriod3() + ", ";
sqlStmt+="GoalsOvertime=" + luBoxScore.getHomeTeamGoalsPerPeriod().getOvertime() + ", ";
sqlStmt+="EmptyNetGoals=" + luBoxScore.getHomeTeamGoalsPerPeriod().getEmptyNetGoals() + " ";
sqlStmt+="WHERE GameIndex=" + dbBoxScore.getHomeTeamGoalsPerPeriod().getGameIndex() + " AND ";
sqlStmt+="TeamIndex=" + luBoxScore.getHomeTeamGoalsPerPeriod().getTeamIndex();
else
sqlStmt="INSERT INTO GameDetailGoalsPerPeriod ";
sqlStmt+="(GameIndex, TeamIndex, GoalsFirstPeriod, GoalsSecondPeriod, GoalsThirdPeriod, ";
sqlStmt+="GoalsOvertime, EmptyNetGoals) VALUES(";
sqlStmt+=dbBoxScore.getBasicGameData().getGameIndex() + ", ";
sqlStmt+=luBoxScore.getHomeTeamGoalsPerPeriod().getTeamIndex() + ", ";
sqlStmt+=luBoxScore.getHomeTeamGoalsPerPeriod().getPeriod1() + ", ";
sqlStmt+=luBoxScore.getHomeTeamGoalsPerPeriod().getPeriod2() + ", ";
sqlStmt+=luBoxScore.getHomeTeamGoalsPerPeriod().getPeriod3() + ", ";
sqlStmt+=luBoxScore.getHomeTeamGoalsPerPeriod().getOvertime() + ", ";
sqlStmt+=luBoxScore.getHomeTeamGoalsPerPeriod().getEmptyNetGoals() + ")";
st.executeUpdate(sqlStmt);
st.close();
protected void updateVisitorGoalsPerPeriod(StatisticalItems.BoxScore dbBoxScore,
StatisticalItems.BoxScore luBoxScore)
throws SQLException
Statement st=m_Connection.createStatement();
String sqlStmt="";
if( dbBoxScore.getVisitorTeamGoalsPerPeriod().getFoundInDatabase() )
sqlStmt="UPDATE GameDetailGoalsPerPeriod SET ";
sqlStmt+="GameIndex=" + dbBoxScore.getVisitorTeamGoalsPerPeriod().getGameIndex() + ", ";
sqlStmt+="TeamIndex=" + luBoxScore.getVisitorTeamGoalsPerPeriod().getTeamIndex() + ", ";
sqlStmt+="GoalsFirstPeriod=" + luBoxScore.getVisitorTeamGoalsPerPeriod().getPeriod1() + ", ";
sqlStmt+="GoalsSecondPeriod=" + luBoxScore.getVisitorTeamGoalsPerPeriod().getPeriod2() + ", ";
sqlStmt+="GoalsThirdPeriod=" + luBoxScore.getVisitorTeamGoalsPerPeriod().getPeriod3() + ", ";
sqlStmt+="GoalsOvertime=" + luBoxScore.getVisitorTeamGoalsPerPeriod().getOvertime() + ", ";
sqlStmt+="EmptyNetGoals=" + luBoxScore.getVisitorTeamGoalsPerPeriod().getEmptyNetGoals() + " ";
sqlStmt+="WHERE GameIndex=" + dbBoxScore.getVisitorTeamGoalsPerPeriod().getGameIndex() + " AND ";
sqlStmt+="TeamIndex=" + luBoxScore.getVisitorTeamGoalsPerPeriod().getTeamIndex();
else
sqlStmt="INSERT INTO GameDetailGoalsPerPeriod ";
sqlStmt+="(GameIndex, TeamIndex, GoalsFirstPeriod, GoalsSecondPeriod, GoalsThirdPeriod, ";
sqlStmt+="GoalsOvertime, EmptyNetGoals) VALUES(";
sqlStmt+=dbBoxScore.getBasicGameData().getGameIndex() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamGoalsPerPeriod().getTeamIndex() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamGoalsPerPeriod().getPeriod1() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamGoalsPerPeriod().getPeriod2() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamGoalsPerPeriod().getPeriod3() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamGoalsPerPeriod().getOvertime() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamGoalsPerPeriod().getEmptyNetGoals() + ")";
st.executeUpdate(sqlStmt);
st.close();
protected void updateHomeShotsPerPeriod(StatisticalItems.BoxScore dbBoxScore,
StatisticalItems.BoxScore luBoxScore)
throws SQLException
Statement st=m_Connection.createStatement();
String sqlStmt="";
if( dbBoxScore.getHomeTeamShotsPerPeriod().getFoundInDatabase() )
sqlStmt="UPDATE GameDetailShotsPerPeriod SET ";
sqlStmt+="GameIndex=" + dbBoxScore.getHomeTeamShotsPerPeriod().getGameIndex() + ", ";
sqlStmt+="TeamIndex=" + luBoxScore.getHomeTeamShotsPerPeriod().getTeamIndex() + ", ";
sqlStmt+="ShotsFirstPeriod=" + luBoxScore.getHomeTeamShotsPerPeriod().getPeriod1() + ", ";
sqlStmt+="ShotsSecondPeriod=" + luBoxScore.getHomeTeamShotsPerPeriod().getPeriod2() + ", ";
sqlStmt+="ShotsThirdPeriod=" + luBoxScore.getHomeTeamShotsPerPeriod().getPeriod3() + ", ";
sqlStmt+="ShotsOvertime=" + luBoxScore.getHomeTeamShotsPerPeriod().getOvertime() + " ";
sqlStmt+="WHERE GameIndex=" + dbBoxScore.getHomeTeamShotsPerPeriod().getGameIndex() + " AND ";
sqlStmt+="TeamIndex=" + luBoxScore.getHomeTeamShotsPerPeriod().getTeamIndex();
else
sqlStmt="INSERT INTO GameDetailShotsPerPeriod ";
sqlStmt+="(GameIndex, TeamIndex, ShotsFirstPeriod, ShotsSecondPeriod, ShotsThirdPeriod, ";
sqlStmt+="ShotsOvertime) VALUES(";
sqlStmt+=dbBoxScore.getBasicGameData().getGameIndex() + ", ";
sqlStmt+=luBoxScore.getHomeTeamShotsPerPeriod().getTeamIndex() + ", ";
sqlStmt+=luBoxScore.getHomeTeamShotsPerPeriod().getPeriod1() + ", ";
sqlStmt+=luBoxScore.getHomeTeamShotsPerPeriod().getPeriod2() + ", ";
sqlStmt+=luBoxScore.getHomeTeamShotsPerPeriod().getPeriod3() + ", ";
sqlStmt+=luBoxScore.getHomeTeamShotsPerPeriod().getOvertime() + ")";
st.executeUpdate(sqlStmt);
st.close();
protected void updateVisitorShotsPerPeriod(StatisticalItems.BoxScore dbBoxScore,
StatisticalItems.BoxScore luBoxScore)
throws SQLException
Statement st=m_Connection.createStatement();
String sqlStmt="";
if( dbBoxScore.getVisitorTeamShotsPerPeriod().getFoundInDatabase() )
sqlStmt="UPDATE GameDetailShotsPerPeriod SET ";
sqlStmt+="GameIndex=" + dbBoxScore.getVisitorTeamShotsPerPeriod().getGameIndex() + ", ";
sqlStmt+="TeamIndex=" + luBoxScore.getVisitorTeamShotsPerPeriod().getTeamIndex() + ", ";
sqlStmt+="ShotsFirstPeriod=" + luBoxScore.getVisitorTeamShotsPerPeriod().getPeriod1() + ", ";
sqlStmt+="ShotsSecondPeriod=" + luBoxScore.getVisitorTeamShotsPerPeriod().getPeriod2() + ", ";
sqlStmt+="ShotsThirdPeriod=" + luBoxScore.getVisitorTeamShotsPerPeriod().getPeriod3() + ", ";
sqlStmt+="ShotsOvertime=" + luBoxScore.getVisitorTeamShotsPerPeriod().getOvertime() + " ";
sqlStmt+="WHERE GameIndex=" + dbBoxScore.getVisitorTeamShotsPerPeriod().getGameIndex() + " AND ";
sqlStmt+="TeamIndex=" + luBoxScore.getVisitorTeamShotsPerPeriod().getTeamIndex();
else
sqlStmt="INSERT INTO GameDetailShotsPerPeriod ";
sqlStmt+="(GameIndex, TeamIndex, ShotsFirstPeriod, ShotsSecondPeriod, ShotsThirdPeriod, ";
sqlStmt+="ShotsOvertime) VALUES(";
sqlStmt+=dbBoxScore.getBasicGameData().getGameIndex() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamShotsPerPeriod().getTeamIndex() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamShotsPerPeriod().getPeriod1() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamShotsPerPeriod().getPeriod2() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamShotsPerPeriod().getPeriod3() + ", ";
sqlStmt+=luBoxScore.getVisitorTeamShotsPerPeriod().getOvertime() + ")";
st.executeUpdate(sqlStmt);
st.close();
protected void updateHomeSpecialTeams(StatisticalItems.BoxScore dbBoxScore,
StatisticalItems.BoxScore luBoxScore)
throws SQLException
Statement st=m_Connection.createStatement();
String sqlStmt="";
if( dbBoxScore.getHomeTeamSpecialTeams().getFoundInDatabase() )
sqlStmt="UPDATE GameDetailSpecialTeams SET ";
sqlStmt+="GameIndex=" + dbBoxScore.getHomeTeamSpecialTeams().getGameIndex() + ", ";
sqlStmt+="TeamIndex=" + luBoxScore.getHomeTeamSpecialTeams().getTeamIndex() + ", ";
sqlStmt+="PowerplayGoals=" + luBoxScore.getHomeTeamSpecialTeams().getPowerplayGoals() + ", ";
sqlStmt+="PowerplayOps=" + luBoxScore.getHomeTeamSpecialTeams().getPowerplayOps() + ", ";
sqlStmt+="ShorthandedGoals=" + luBoxScore.getHomeTeamSpecialTeams().getShorthandedGoals() + ", ";
sqlStmt+="ShorthandedOps=" + luBoxScore.getHomeTeamSpecialTeams().getShorthandeits because you use hungarian notation - that was the hollywood squares answer.
It looks like a bug in either the ntdll or the JdbcOdbc dll, so I'd see if you can't isolate the problem (like using a smaller bit of code) and file a bug report. Find out exacty what your sql statement is which causes this to crash - hint : line 215 -
Using Multiple Parameters in Select Statement
My goal is to be able to use more than one parameter for the select statement. When I use OR instead of AND it works but with only one parameter. I thought using AND would return any parameter that is listed in the ?Report Based On}. Any ideas why this will not work?
I've created four parameters:
Report Based on (string) Allow Multiple Values (Default Values: Customer, Part Id, and Serial Number)
RMA info by Customer (string)
RMA Info by Part Id (string)
RMA Info by SN (string)
This is my select statement
(if {?Report Based On} = "Customer" then
{RMA_Information.Customer}LIKE{?RMA info by Customer})
and
(if {?Report Based On} = "Part Id" then
{RMA_Information.Part Id}LIKE{?RMA Info by Part Id})
and
(if {?Report Based On} = "Serial Number" then
{RMA_Information.Serial Number}={?RMA Info by SN })
tx ShirleyTry this...
IF "Customer" IN {?Report Based On} AND
"Part Id" IN {?Report Based On} AND
"Serial Number" IN {?Report Based On}
THEN {RMA_Information.Customer}LIKE{?RMA info by Customer} AND
{RMA_Information.Part Id}LIKE{?RMA Info by Part Id} AND
{RMA_Information.Serial Number}={?RMA Info by SN}
ELSE
IF "Customer" IN {?Report Based On} AND
"Part Id" IN {?Report Based On}
THEN {RMA_Information.Customer}LIKE{?RMA info by Customer} AND
{RMA_Information.Part Id}LIKE{?RMA Info by Part Id}
ELSE
IF "Customer" IN {?Report Based On} AND
"Serial Number" IN {?Report Based On}
THEN {RMA_Information.Customer}LIKE{?RMA info by Customer} AND
{RMA_Information.Serial Number}={?RMA Info by SN}
ELSE
IF "Part Id" IN {?Report Based On} AND
"Serial Number" IN {?Report Based On}
THEN {RMA_Information.Part Id}LIKE{?RMA Info by Part Id} AND
{RMA_Information.Serial Number}={?RMA Info by SN}
ELSE
IF "Customer" IN {?Report Based On}
THEN {RMA_Information.Customer}LIKE{?RMA info by Customer}
ELSE
IF "Part Id" IN {?Report Based On}
THEN {RMA_Information.Part Id}LIKE{?RMA Info by Part Id}
ELSE
"Serial Number" IN {?Report Based On}
THEN {RMA_Information.Serial Number}={?RMA Info by SN}
HTH,
Jason -
How to use 'is null' in select statement of ABAP program
hi,
I want to use 'is nul' or 'not null' in select statement of my ABAP program for any field. I have written below query but I am getting sy-subrc = 4 and getting no data.
SELECT * FROM mara INTO TABLE it_mara
WHERE volum IS NULL .
Can anyone resolve this.Hi PKB,
Check the below thread for NULL and Space value in ABAP . It will help you
NULL and Space value in ABAP
Regards,
Pawan -
Use of wildcard * in SELECT statement
I have read that the use of the wildcard * in a SELECT statement cannot be utilized when using the INSERT INTO or other queries where data column/field alignment is critical. I have noted that the INSERT INTO column/fields must be in the same order
as the SELECT statement (as there is no alignment to column/field names). Can someone please provide me with the information or article that covered this scenario?It is consider a good practice to specify columns name, however , SQL Server is smart enough to insert the data without too , but only if the table does not have an IDENTITY property
CREATE TABLE #t (c1 int, c2 char(1),c3 real, c4 bit)
CREATE TABLE #t1 (c1 int, c2 char(1),c3 real, c4 bit)
---Same thing with INSERT like SELECT * you asked
INSERT INTO #t1 VALUES (1,'A',2.5,0)
INSERT INTO #t1 VALUES (2,'B',3.5,1)
INSERT INTO #t1 VALUES (3,'C',4.5,0)
INSERT INTO #t SELECT * FROM #t1
SELECT * FROM #t
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Using variables in a fix statement
I am using a nested fix statement on a dense member and would like to use variables to represent certain intersections. Since the variables need to be within a calc member bloc, where do I place them? Do they go inside the fix statement witht the parenthesis just around teh variables or the last parenthesis at the end of the fix statement?
If you mean substitution variables, they are defined outside the calc script at a dp, app, or server level. They simply substitute their textual value at the place they appear in the script. If the substitution results in a valid calc script where it occurs, then you are fine. So FIX ( &subvar ) could be valid.If you mean temporary variables, they hold intermediate calculational values. The docs say "VAR commands can only be assigned values within a member calculation or when VAR is declared. " That is, you may either say 'VAR tempvar = 1000; ' [declare and set value] or 'VAR tempvar;' [declare only, often at the start of your script] then somewhere in the script 'tempvar = expression;' [value gets assigned]. This last expression would not appear within the parentheses of a FIX ( members ) statement, but somewhere within the FIX block. You would never say FIX ( tempvar ) as it is not an outline member.
Maybe you are looking for
-
How can i reset my ipad 2 without my apple password because Ive forgotton it
i want to reset my Ipad 2 but have forgotton my apple password. Can I reset it without the password? Im desperate for a solution. Can anyone out there help please?
-
How to export a PDF including all of the borders?
I am very new to InDesign. I have only used it a handful of times and am unfamiliar with setting up pages. I was given a file and I have to export it. The problem is that, when I export it as a PDF, a small part of the image is cut off on each page
-
IDoc error "customer and sales area : GR could not be uniquely determined"
Hi All, While posting some IDocs i am getting error customer and sales area : GR could not be uniquely determined even when entries are available in EDSDC table. Please assist.
-
Help on conditionally Formatting Field in a Cross Tab
Hi all, I like to conditionally format a number field in a cross tab, ie. on a certain column the number should show 2 decimal places, otherwise no decimal places. I have tried a formula in the Decimals of the Format Field, If {Command.COL_TITLE}= "
-
How can changes happened during the cube activation be nullified.
Hi all, I was trying to activate some business content infocube in the dev.server. I selectecd data flow before. In the process I collected all infoobjects associated with the cube and all the info-objects which are associated with that info-objects.