Different result from same SQL statement
The following SQL statement brings back records using query
analyzer on the SQL server. However when I run it in a cold fusion
page it comes back with no results. Any idea why????????
SELECT COUNT(h.userID) AS hits, u.OCD
FROM dbo.tbl_hits h INNER JOIN
dbo.tlkp_users u ON h.userID = u.PIN
WHERE (h.appName LIKE 'OPwiz%') AND (h.lu_date BETWEEN
'05/01/07' AND '06/01/07')
GROUP BY u.OCD
ORDER BY u.OCD
Anthony Spears wrote:
> That didn't work either.
>
> But here is something interesting. If we use the dates
05/01/2007 and
> 06/01/2007 we get results in SQL Server Query Analyzer
but not using a cold
> fusion page. But if we use the dates 05/01/2007 and
09/01/2007 both get back
> the same results.
>
Are you absolutely, 100% sure that you are connecting to the
same
database instance with both CF and Query Analyzer? That kind
of symptom
is 9 out of 10 times because the user is looking at different
data. One
is looking at production and the other development or an
backup or
recent copy or something different.
Similar Messages
-
How to export the result from executing sql statement to excel file ?
HI all,
Great with Oracle SQL Developer, but I have have a trouble as follwing :
I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
anyone can help me to do that ? Thanks so much
SigmasvnHello Sue,
I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
AddVMOption -Duser.language=en
AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
Regards
Marcus -
Different result froma same MDX
I'm using this MDX:
WITH
member [Measures].[RIGA] as [Commerciale].[Nominativo].CurrentMember.Name
SELECT {
[Measures].[RIGA] , [Measures].[Fatturato]
} ON 0,
non empty( [Incasso].[Mod Pag].Members, [Incasso].[Cond Pag].members, [Data].[Periodo].[Mese].&[2014]&[8], [Commerciale].[Nominativo].&[VALUEA] ) on rows
FROM [MYADSB]
if i run in query anylizer i have a result like this
All
All
Agosto
VALUEA
VALUEA
1,139
All
30
Agosto
VALUEA
VALUEA
1,139
RIBA
All
Agosto
VALUEA
VALUEA
1,139
RIBA
30
Agosto
VALUEA
VALUEA
1,139
if i run same MDX as a dataset in SSRS i have this results:
All
All
Agosto
VALUEA
VALUEA
1,139
RIBA
30
Agosto
VALUEA
VALUEA
1,139
RIBA
All
Agosto
VALUEA
VALUEA
1,139
RIBA
30
Agosto
VALUEA
VALUEA
1,139
The second row is changed from All 30 to RIBA 30, how it is possible?i checked with sql profiler and the query are the same.
The dimension incasso is derived from this table
id
modPag
CondPag
BO30
BONIFICO
30
BO60
BONIFICO
60
BO90
BONIFICO
90
RB30
RIBA
30
RB40
RIBA
40
RB45
RIBA
45
RB60
RIBA
60
RB90
RIBA
90
using [Incasso].[Mod Pag].Members, [Incasso].[Cond Pag].members I should see 4 row
ModPag
CondPAg
All
All
All
30
RIBA
All
RIBA
30
but I see
MOdPag
CondPAg
All
All
RIBA
30
RIBA
All
RIBA
30 -
Invalid identifier results from an sql statement in php
hello there, i'm trying to access data from an oracle 11g database via oci and php 5.3.8.
i'm getting the ORA-00904 (invalid identifier) error when executing the following statement:
$stid = oci_parse($conn, 'select * from table1 where column1 = "XYZ"');
when i do this:
$searchstring = "XYZ";
$stid = oci_parse($conn, 'select * from table1 where column1 = '.$searchstring.'');
i'm getting this error:
ORA-00933: SQL command not properly ended
column1 is varchar2, the entries are either letters and numbers (never only numbers) or empty.
when i do this:
$stid = oci_parse($conn, 'select * from table1');
i'm getting the data and there are entries in column1 with XYZ.
has anyone an idea, what i do wrong?
regards jThe PHP forum for questions like this is at http://www.oracle.com/technetwork/forums/php/index.html
You really need to be using a bind variable here. Otherwise you will likely suffer from poor DB performance, and also open yourself to SQL Injection security attacks. Try:
$stid = oci_parse($conn, 'select * from table1 where column1 = :bv');
oci_bind_by_name($stid, ":bv", $searchstring);Regarding quoting of your example try:
$searchstring = "XYZ";
echo 'select * from table1 where column1 = '.$searchstring.'';Then run that SQL in SQL*Plus and watch it fail. What you need is given with:
echo 'select * from table1 where column1 = \''.$searchstring.'\'';See the bottom of p 126 of The Underground PHP and Oracle Manual
Note that with the bind variable example you didn't need quotes around :bv. -
Why do I get two different results from the same coefficients?
I am getting two different results from the Polynomial Evaluation function.
For the first one, I am getting the coefficients from a Polynomial Fit function. I feed the coefficients from the Fit function into the Poly Eval function and get the correct result of 12.8582 when I evaluate 49940.
For the second one, I create constant array of the SAME values that were returned from the Polynomial Fit function (i typed them in). However, I am getting an incorrect result of -120.7913 when I feed the constant array into the Poly Eval function when I evauate 49940.
How can this happen when I am using the same array values?
Attached is an image of what I am explaining.
Solved!
Go to Solution.
Attachments:
polynomial_evaluation.jpg 213 KBHi Altran,
are you sure about using the "same" coefficients?
Did you compare them? Did you (atleast) set the display properties to 17 significant digits?
Please attach a VI instead of a picture...
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
Different results on a SQL sort depending on the tool?
Hi,
i've a problem with sorting a column, getting different results depending on the tool.
Environment:
Oracle 8.1.6 on Solaris, Oracle Client on NT 4.0 (SP5)
The Query:
SELECT * FROM mytable ORDER BY mycolumn ASC
This is the result of a query by SQL Plus Worksheet:
0000000006
0000100100
A00000
A06015
A06016
This is the result of a query by SQL*Plus (and Oracle ODBC 32Bit Test and a jdbc query) :
A00000
A06015
A06016
0000000006
0000100100
Why has the same SQL statement different results?
Why are there different collating orders?
How can this be solved?
Can anyone help me?
Regards Stefan
nullAt this point I think you should get Applejack...
http://www.macupdate.com/info.php/id/15667/applejack
After installing, reboot holding down CMD+s, (+s), then when the DOS like prompt shows, type in...
applejack AUTO
Then let it do all 6 of it's things.
At least it'll eliminate some questions if it doesn't fix it.
The 6 things it does are...
Correct any Disk problems.
Repair Permissions.
Clear out Cache Files.
Repair/check several plist files.
Dump the VM files for a fresh start.
Trash old Log files.
First reboot will be slower, sometimes 2 or 3 restarts will be required for full benefit... my guess is files relying upon other files relying upon other files! :-)
Disconnect the USB cable from any Uninterruptible Power Supply so the system doesn't shut down in the middle of the process.
Then... Try putting these numbers in Network>TCP/IP>DNS Servers, for the Interface you connect with...
208.67.222.222
208.67.220.220
Then Apply. For 10.5/10.6 Network, highlight Interface>Advanced button>DNS tab>little + icon.
DNS Servers are a bit like Phone books where you look up a name and it gives you the phone number, in our case, you put in apple.com and it comes back with 17.149.160.49 behind the scenes.
These Servers have been patched to guard against DNS poisoning, and are faster/more reliable than most ISP's DNS Servers.
The Interface that connects to the Internet, needs to be drug to the top of System Preferences>Network>Show:>Network Port Configurations and checked ON.
10.5.x/10.6.x instructions...
System Preferences>Network, click on the little gear at the bottom next to the + & - icons, (unlock lock first if locked), choose Set Service Order.
The interface that connects to the Internet should be dragged to the top of the list. -
Multiple Executions Plans for the same SQL statement
Dear experts,
awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.
Below is the awrsqrpt's output for your reference.
WORKLOAD REPOSITORY SQL Report
Snapshot Period Summary
DB Name DB Id Instance Inst Num Release RAC Host
TESTDB 2157605839 TESTDB1 1 10.2.0.3.0 YES testhost1
Snap Id Snap Time Sessions Curs/Sess
Begin Snap: 32541 11-Oct-08 21:00:13 248 141.1
End Snap: 32542 11-Oct-08 21:15:06 245 143.4
Elapsed: 14.88 (mins)
DB Time: 12.18 (mins)
SQL Summary DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
Elapsed
SQL Id Time (ms)
51szt7b736bmg 25,131
Module: SQL*Plus
UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(ACCT_DR_BAL,
0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND TEST_ACC_NB = ACCT_ACC_NB(+)) WHERE
TEST_BATCH_DT = (:B1 )
SQL ID: 51szt7b736bmg DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> 1st Capture and Last Capture Snap IDs
refer to Snapshot IDs witin the snapshot range
-> UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(AC...
Plan Hash Total Elapsed 1st Capture Last Capture
# Value Time(ms) Executions Snap ID Snap ID
1 2960830398 25,131 1 32542 32542
2 3834848140 0 0 32542 32542
Plan 1(PHV: 2960830398)
Plan Statistics DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 25,131 25,130.7 3.4
CPU Time (ms) 23,270 23,270.2 3.9
Executions 1 N/A N/A
Buffer Gets 2,626,166 2,626,166.0 14.6
Disk Reads 305 305.0 0.3
Parse Calls 1 1.0 0.0
Rows 371,735 371,735.0 N/A
User I/O Wait Time (ms) 564 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 0 N/A N/A
Invalidations 0 N/A N/A
Version Count 2 N/A N/A
Sharable Mem(KB) 26 N/A N/A
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | | | 1110 (100)| |
| 1 | UPDATE | TEST | | | | |
| 2 | TABLE ACCESS FULL | TEST | 116K| 2740K| 1110 (2)| 00:00:14 |
| 3 | TABLE ACCESS BY INDEX ROWID| ACCT | 1 | 26 | 5 (0)| 00:00:01 |
| 4 | INDEX RANGE SCAN | ACCT_DT_ACC_IDX | 1 | | 4 (0)| 00:00:01 |
Plan 2(PHV: 3834848140)
Plan Statistics DB/Inst: TESTDB/TESTDB1 Snaps: 32541-32542
-> % Total DB Time is the Elapsed Time of the SQL statement divided
into the Total Database Time multiplied by 100
Stat Name Statement Per Execution % Snap
Elapsed Time (ms) 0 N/A 0.0
CPU Time (ms) 0 N/A 0.0
Executions 0 N/A N/A
Buffer Gets 0 N/A 0.0
Disk Reads 0 N/A 0.0
Parse Calls 0 N/A 0.0
Rows 0 N/A N/A
User I/O Wait Time (ms) 0 N/A N/A
Cluster Wait Time (ms) 0 N/A N/A
Application Wait Time (ms) 0 N/A N/A
Concurrency Wait Time (ms) 0 N/A N/A
Invalidations 0 N/A N/A
Version Count 2 N/A N/A
Sharable Mem(KB) 26 N/A N/A
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | | | 2 (100)| |
| 1 | UPDATE | TEST | | | | |
| 2 | TABLE ACCESS BY INDEX ROWID| TEST | 1 | 28 | 2 (0)| 00:00:01 |
| 3 | INDEX RANGE SCAN | TEST_DT_IND | 1 | | 1 (0)| 00:00:01 |
| 4 | TABLE ACCESS BY INDEX ROWID| ACCT | 1 | 26 | 4 (0)| 00:00:01 |
| 5 | INDEX RANGE SCAN | INDX_ACCT_DT | 1 | | 3 (0)| 00:00:01 |
Full SQL Text
SQL ID SQL Text
51szt7b736bm UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL, 0) +
NVL(ACCT_DR_BAL, 0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND PB
RN_ACC_NB = ACCT_ACC_NB(+)) WHERE TEST_BATCH_DT = (:B1 )Your input is highly appreciated.
Thanks for taking your time in answering my question.
RegardsOracle Lover3 wrote:
Dear experts,
awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.If you're using bind variables and you've histograms on your columns which can be created by default in 10g due to the "SIZE AUTO" default "method_opt" parameter of DBMS_STATS.GATHER__STATS it is quite normal that you get different execution plans for the same SQL statement. Depending on the values passed when the statement is hard parsed (this feature is called "bind variable peeking" and enabled by default since 9i) an execution plan is determined and re-used for all further executions of the same "shared" SQL statement.
If now your statement ages out of the shared pool or is invalidated due to some DDL or statistics gathering activity it will be re-parsed and again the values passed in that particular moment will determine the execution plan. If you have skewed data distribution and a histogram in place that reflects that skewness you might get different execution plans depending on the actual values used.
Since this "flip-flop" behaviour can sometimes be counter-productive if you're unlucky and the values used to hard parse the statement leading to a plan that is unsuitable for the majority of values used afterwards, 11g introduced the "adaptive" cursor sharing that attempts to detect such a situation and can automatically re-evaluate the execution plan of the statement.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Does anyone know why I would get different results from V$Rman_Backup_job_details and V$Rman_Status on the same instance?
Image of Quries: www.hydell.com/OracleBackupDifferences.png
Dates Returned For Latest Backup
V$Rman_Status = 10/13/2011
V$Rman_Backup_job_details = 7/24/2011
Which view is the best to use for monitoring backups?
Thanks in advance for the help.
Roboracle.dba.89 wrote:
Please show the script and that might help look into this. Also the timezone of the OS shows EST. And cron shows the scheduled time at 12hrs. It should run at 12:00 EST hours and not GMT.
Also please post output for below queries. Are backups run from the same node? (If RAC)
select value from dba_scheduler_global_attribute where attribute_name = 'DEFAULT_TIMEZONE';
Hi,
This is the backup script
#Set Variables
ORACLE_HOME=/projects1/oramroprod/oracle/product/10.2.0/db_4
ORACLE_SID=MROPROD
PATH=$PATH:$ORACLE_HOME/bin
btype="FULL"
RMAN_BACKUP_LOC=/data1/RMAN/MROPROD
export ORACLE_HOME
export ORACLE_SID
export PATH
export btype
tag="$ORACLE_SID"_"$btype"
#Print commands and their arguments as they are executed
set -x
SDATE=`date +%m%d%y`
STIME=`date +%H%M%S`
DD=`date +%d%m%y`
#Create daily backup directories
mkdir -p $RMAN_BACKUP_LOC/datafiles_backup/bkp_${DD}
mkdir -p $RMAN_BACKUP_LOC/controlfile_backup/bkp_${DD}
mkdir -p $RMAN_BACKUP_LOC/arch_backup/bkp_${DD}
mkdir $RMAN_BACKUP_LOC/logs
#Take backup
rman target / nocatalog log=$RMAN_BACKUP_LOC/logs/rman_${btype}_backup_${SDATE}_${STIME}.log << EOF1
change archivelog all crosscheck;
run {
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
backup as compressed backupset incremental level 0 database tag '$tag' format '$RMAN_BACKUP_LOC/datafiles_backup/bkp_${DD}/%d_%s_%p';
backup as compressed backupset archivelog all not backed up 1 times FORMAT '$RMAN_BACKUP_LOC/arch_backup/bkp_${DD}/ARCH_%d_%s_%p';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '$RMAN_BACKUP_LOC/controlfile_backup/bkp_${DD}/%F';
delete noprompt obsolete;
delete noprompt archivelog all completed before 'sysdate-2';
EXIT;
EOF1
This is not RAC.
SQL> select value from dba_scheduler_global_attribute where attribute_name = 'DEFAULT_TIMEZONE';
VALUE
GMT -
Different results from all_objects
Can someone please explain me,
How it is possible to get different results from "all_objects", once I query it from "SQL Worksheet" and next time when I execute the procedure with the same query ?
The procedure is created by schema user (owner) and it's executed by it.
Same as the query.
I am querying for objects which belongs to other owners.
Is there a way how to trace which privileges are used for querying the "all_objects" ?
Any hint will be very welcomed ?You are correct, sorry.
Oracle 11g EE 11.2.0.1.0 - 64bit Production on Windows 2K8
I already lost my whole day, probably I will lost the weekend, too.
Here is the sample code:
CREATE OR REPLACE PROCEDURE PROCEDURE1 AS
BEGIN
FOR c IN (SELECT object_name from all_objects d
WHERE d.owner IN ('DWH_CM')
LOOP
dbms_output.put_line(c.object_name);
end loop;
END PROCEDURE1;
Test
exec procedure1;
-- does not write anything in output and it is enabled
select object_name
from all_objects O
WHERE o.owner IN ('DWH_CM');
-- returns 99 rows
Edited by: user9377205 on Aug 6, 2010 9:06 AM -
Count the number of rows resulting from a select statement
Hi,
Is there any way of counting the number of rows resulting from a select statement. i.e I have a select distinct statement and I then want to perform an IF statement on the number of rows resulting from the select statement.
Any help appreciated
Thanks
GaryDeclare
var1 number;
Begin
select count(distinct column_name) into
var1 from table_name;
If var1 > x Then
End IF;
End;
Hope I understood the problem correctly
null -
High Database server load from expensive SQL statements
Dear all,
I am facing problem in the production sever there is high Database server load from expensive SQL statements as per EVA report
Buffer Load [%] Disk Load [%] CPU Load [%]
55 69 0
Analysis of DB SQL CACHE
EXPENSIVE SQL STATEMENTS OVERVIEW
Object Name CPU Load [%] I/O Load [%] Elapsed Time [%] Executions Records Processed
BSIS 1 9 0 22 90462
CDEF$ 6 6 0 2131113 2575694
BSAD 1 3 0 21 408576
MKPF 1 32 0 180 3899
ICOL$ 9 1 0 2575694 8703798
OBJ$ 6 1 0 3405254 3400023
COL$ 12 0 0 2138793 22919657
MKPF 1 13 0 75 396
MCHB 7 0 0 366543 41708
Please suggest the step by step to reduce the expensive SQL from these table.
RegardsHi,
In tx code ST05 i have find the following deatails.
Duration |Obj. name |Op. |Recs.|RC |Statement
4 TSP03A REOPEN 0 SELECT WHERE "NAME" = 'LOCL' AND "P" = 'S_CLIENTS' 344 TSP03A FETCH 1 0 42 ZRIN DECLARE 0 SELECT WHERE "MANDT" = :A0 AND "BCQ" = :A1 442 ZRIN PREPARE 0 SELECT WHERE "MANDT" = :A0 AND "BCQ" = :A1 3 ZRIN OPEN 0 SELECT WHERE "MANDT" = '600' AND "BCQ" = 'BCQ'
2,181,565 ZRIN FETCH 4 1403
706,267 DBA_SEGME FETCH 99 0 8,248 DBA_SEGME FETCH 99 0 44,994 DBA_SEGME FETCH 99 0 67,713 DBA_SEGME FETCH 99 0
1,367,923 DBA_SEGME FETCH 99 0
16,735|TADIR |FETCH | 1| 1403| |
5
TADIR
REOPEN
0
SELECT WHERE "PGMID" = 'R3TR' AND "OBJECT" = 'TABL' AND "OBJ_NAME" = 'CME__TEXT'
22,415
TADIR
FETCH
1
1403
4
TADIR
REOPEN
0
SELECT WHERE "PGMID" = 'R3TR' AND "OBJECT" = 'TABL' AND "OBJ_NAME" = 'CME_PATTERN_SIGN'
232
TADIR
FETCH
1
1403
4
TADIR
REOPEN
0
SELECT WHERE "PGMID" = 'R3TR' AND "OBJECT" = 'TABL' AND "OBJ_NAME" = 'CML_ARC_DEADLINE'
19,189
TADIR
FETCH
1
1403
4
TADIR
REOPEN
706,267
DBA_SEGME
FETCH
99
0
|
44,994
DBA_SEGME
FETCH
99
0
67,713
DBA_SEGME
FETCH
99
0
Please suggest how to reduce it.
Regards, -
Same sql statement two different results?
Hi,
I was wondering if anyone knows why I am getting different
results on the same query.
Basically... when I run this query in "view" in sql server, I
get the results I need, however when I run in Coldfusion, I am
getting totally different results.... It is a totally different
result...
the query:
SELECT DISTINCT
tbl_employees.indexid, tbl_employees.[Employee ID] as
employeeid, tbl_employees.[First Name] as firstname,
tbl_employees.[Last Name] as lastname,
tbl_employees.[Supervisor ID] as supervisorid,
tbl_workaddress_userdata.firstname,
tbl_workaddress_userdata.lastname,
tbl_workaddress_userdata.supervisorid,
tbl_workaddress_userdata.location,
tbl_workaddress_userdata.employeeid,
tbl_workaddress_userdata.locationdescription
FROM tbl_employees FULL OUTER JOIN
tbl_workaddress_userdata ON tbl_employees.[Employee ID] =
tbl_workaddress_userdata.employeeid
WHERE (tbl_employees.[Supervisor ID] = 7) AND
(tbl_workaddress_userdata.location IS NULL)I suspect you and your CF DSN are looking at two different
DBs...
Adam -
PreparedStatement & regular Statement - different results for same select
I was wondering if someone could either
i) try this out for me to confirm my results or
ii) let me know what I am doing wrong
I'm one of the developers on a product and am currently investigating localization for the Thai language...just checking to see that Java and Swing have no problems with it. The only bewildering thing which has happened is noticing that some values which are fetched from the database display in Thai perfectly and other values display as a garble. Sometimes the exact same column is displayed correctly in one part of the program but is not OK in another part. I think I've figured out what it going on and suspect a bug in Oracle's JDBC:
Some selects were configured as PreparedStatements and those return the Thai properly. The more common case however was for programmers to use a simple Statement object for their select and it is in those that the multi-byte strings don't get returned properly.
The following code shows the problem that I am experiencing. I am basically executing the exact same select in 2 different ways and they are both giving different results as long as the column being queried contains a Thai character. If someone could grab and check it out and let me know if they see the same thing, I'd appreciate it. Just change the column/table name and the username/password/databaseIP to get it to run.
<code>
import java.sql.*;
public class SelectTest {
public static void main(String[] args) {
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@10.4.31.168:1524:ora8",
"dms_girouard",
"girouard");
String sqlCommand = "select C0620_Title from T0620_SwSheet";
Statement statement = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet resultSet1 = statement.executeQuery(sqlCommand);
while (resultSet1.next()) {
if (resultSet1.getString("C0620_Title") != null) {
System.out.println("resultSet1 Title = " + resultSet1.getString("C0620_Title"));
PreparedStatement preparedStatement = conn.prepareStatement(sqlCommand);
ResultSet resultSet2 = preparedStatement.executeQuery();
while (resultSet2.next()) {
if (resultSet2.getString("C0620_Title") != null) {
System.out.println("resultSet2 Title = " + resultSet2.getString("C0620_Title"));
catch (Exception e) {
System.out.println(e.getMessage());
</code>Hi Peter,
Are you using NCHAR column for Thai , or is your database character set set for Thai.
If you are using a NCHAR column for holding Thai data, then you have to use the
OraclePreparedStatement.setFormOfUse(...) before executing the select.
Regards
Elango. Hi Elangovan,
Thank you for answering.
The datatype on the column is VARCHAR2.
I did my initial tests without doing anything special to make sure the database is localized for Thai, and I was happy to find that almost everything still worked fine - I was able to save and retrieve Thai strings to the database almost perfectly.
The only problem I discovered was the difference between Statement and PreparedStatement selects on a column containing Thai. Colleagues of mine have said they see the same thing when testing on a Oracle database which has been configured specifically for the Thai customer.
I read somewhere that the current JDBC drivers are using an older version of the Unicode standard than the most current version of the Java SDK and that it was causing some problems with Korean. I'm wondering if maybe it's the same problem with Thai. -
Different results of same calculation between SQL and PL/SQL
This SQL statement:
select 1074 * (4 / 48) from dual;Gives the result 89.5.
However this PL/SQL block
declare
tmp NUMBER;
begin
SELECT 1074 * (4 / 48) into tmp from dual;
dbms_output.put_line('Result '||tmp);
end;Gives a different result:
Result 89.49999999999999999999999999999999999996
If I change and give my variable tmp a precision and scale, say (38,36) then the result is 89.5.
Edit. I have done this on both 10g (10.2.0.4.0) and 11g (11.1.0.7.0) with the same result in both.
Edited by: kendenny on Jul 9, 2010 10:19 AM for additional informationWhat's your current NUMWIDTH value in SQL*Plus (I'm assuming you are using that as your tool)?
SQL> set numwidth 50
SQL> select 1074 * (4 / 48) from dual;
1074*(4/48)
89.49999999999999999999999999999999999996 -
How to processing the results from the select statement in SQL query?
Hi
This might be too simple, but my knowledge of the SQL is very limited...
I have table where I do have details from calls (Lync QoE).
I can take all calls from the table, but I would like to count the concurrent calls on the table. This is how I got it work on the Excel to work (but I would like to do that on the SQL statement to get it more dynamic use):
Table have these line and this is what I get out from the Select):
[callid],[start],[end]
1ABC,1.1.2014 01:00:15, 1.1.2014 01:01:00
5DEF,1.1.2014 01:00:45, 1.1.2014 01:05:00
FDE2,1.1.2014 01:03:15, 1.1.2014 01:04:00
KDJ8,1.1.2014 01:04:15, 1.1.2014 01:06:00
FDJ8,2.1.2014 01:04:15, 2.1.2014 01:06:00
KDSE,3.1.2014 01:04:15, 3.1.2014 01:06:00
The information I would like to get, is what is the maximum amount of the concurrent calls per day.
On the excel I basically count line by line how many concurrent calls each line have had, and then pickup the highest one. On above example the calls 5DEF, FDE2 and FDE2 have been active at the same time which gives 3 for the first day.
The table is ordered by the start. So let say the code is on the third line (FDE2). I need to count calls from before which end time is after the start time (of FDE2), but also I need to count calls after (FDE2) which are started before the current
call has ended.
PetriUnfortunately your post is off topic as it's not specific to SQL Server Samples and Community Projects.
This is a standard response I’ve written in advance to help the many people who post their question in this forum in error, but please don’t ignore it. The links I provide below will help you determine the right forum to ask your question in.
For technical issues with Microsoft products that you would run into as an end user, please visit the Microsoft Answers forum ( http://answers.microsoft.com ) which has sections for Windows, Hotmail,
Office, IE, and other products.
For Technical issues with Microsoft products that you might have as an IT professional (like technical installation issues, or other IT issues), please head to the TechNet Discussion forums at http://social.technet.microsoft.com/forums/en-us, and
search for your product name.
For issues with products you might have as a Developer (like how to talk to APIs, what version of software do what, or other developer issues), please head to the MSDN discussion forums at http://social.msdn.microsoft.com/forums/en-us, and
search for your product or issue.
If you’re asking a question particularly about one of the Microsoft Dynamics products, a great place to start is here: http://community.dynamics.com/
If you think your issue is related to SQL Server Samples and Community Projects and I've flagged it as Off-topic, I apologise. Please repost your question and include as much detail as possible about your problem so that someone can assist you further.
If you really have no idea where to post your question please visit the Where is the forum for…? forum http://social.msdn.microsoft.com/forums/en-us/whatforum/
When you see answers and helpful posts, please click Vote As Helpful,
Propose As Answer, and/or Mark As Answer
Jeff Wharton
MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt), MCT, MCPD, MCSD, MCSA, MCITP, MCDBA
Blog: Mr. Wharty's Ramblings
Twitter: @Mr_Wharty
MC ID:
Microsoft Transcript
Maybe you are looking for
-
LR won't import raw files shot in monochrome
I just shot a wedding. Half the images were shot in color, the other half were shot in monochrome(black and white). upon importing into lightroom only the color images would import. With the black and white files I got the error message saying that t
-
Can I use Datapump for replication of Delta from one database to another
Good Morning Experts, I would like to know if can we use Data Pump (expdp and impdp) for replication between two database only for delta and not for complete database on daily basis and how? Regards, MS
-
Fetching lazy attribute problem
Hi all. I have a simple question. How can i get an unfetched value of an entity attribute marked in my jpa as +@Basic (fetch = FetchType.LAZY)+ +@Column(name="DEPARTMENT_NAME", nullable = false, length = 30)+ private String departmentName; when i try
-
Can some one help me configuring orcle alerts(Alert manager) we are using exchange as an SMTP the workflow mailer has been configured with the same exhcnage
-
hi i have a table in my logon screen i what to hide it when the page load how can i do that. i what to display the table when i click my goImageLink my table is <af:goImageLink text="Enter New Password" id="gil1"/> <table> <tbody> <tr> <td width="115