SQL- Query that return only one record
Hello,
is it possible to execute a pure SQL-Query which returns only one row although multiple rows are found.
It is no problem in PL/SQL, but I have no idea if the same is also possible in SQL.
thanks in advance
Michael
Why not? There are 4 records in this table, but only selected one.
SQL> with t
2 as
3 (
4 select '#%$@#$@$@##$' Addr from dual
5 union all
6 select '18 Jalan Scott' from dual
7 union all
8 select '18 Lemana St' from dual
9 union all
10 select '32-penstation' from dual
11 union all
12 select '99999999999' from dual
13 )
14 select addr
15 from t
16 where rownum =1
17 /
ADDR
#%$@#$@$@##$
SQL>Cheers
Sarma.
Similar Messages
-
Dg4odbc 11.2 to mysql desc table issue, query return only one record
<h2>Hi,
I have the following set up:
11g R2 RAC oracle database, dg4odbc 11.2, UnixODBC 2.3 driver manager, MySQL ODBC 5.1.7 Driver on 64 bit Suse SLES 11 server.
Remote database MySQL version 5.0.67 running on 32 bit linux server.
I am having the following Issues:
1. When desc table, sometimes only the first field is shown:
SQL> desc sub_index@mybilltracker;
Name Null? Type
subject_id NOT NULL NUMBER(20)
SQL> desc "sub_index"@mybilltracker;
Name Null? Type
subject_id NOT NULL NUMBER(20)
Some other times I am able to see the correct table definition:
SQL> desc "sub_index"@mybilltracker;
Name Null? Type
subject_id NOT NULL NUMBER(20)
sess_id NUMBER(10)
sess_yr NUMBER(10)
subject_name VARCHAR2(255)
SQL> desc sub_index@mybilltracker;
Name Null? Type
subject_id NOT NULL NUMBER(20)
2. Select count(*) returns the total number of rows correctly. Select * or Select "field name" from table returns only one row:
SQL> select count(*) from "mbt_user"@mybilltracker;
COUNT(*)
2
SQL> select "user_id", "email" from "mbt_user"@mybilltracker; _(always return only one record!)_
user_id email
1 [email protected]
Has anybody seen this? Can somebody help me pinpoint the problem? Thank you!
</h2>
=======================================
<h2>Params in odbc.ini:[ODBC Data Sources]
myodbc5 = MyODBC 5.17 Driver DSN
[myodbc5]
Driver = /usr/local/lib/libmyodbc5.so
Description = Connector/ODBC 5.17 Driver DSN
SERVER = *serverip
PORT = *port
USER = *user
Password = *password
Database = MyBillTracker
#CHARSET = latin1
QuotedId = Yes
AnsiNPW = Yes
TRACEFILE = /tmp/myodbc-MyBillTracker.trc
TRACE = OFF
</h2>
=======================================
<h2>params in initmyodbc5.ora
# HS init parameters
HS_FDS_CONNECT_INFO = myodbc5
HS_FDS_TRACE_LEVEL = DEBUG
HS_FDS_SHAREABLE_NAME = /usr/local/lib/libodbc.so
HS_LANGUAGE=AMERICAN_AMERICA.WE8ISO8859P1
HS_FDS_SUPPORT_STATISTICS=FALSE
# ODBC specific environment variables
set ODBCINI=/usr/local/etc/odbc.ini
</h2>
===========================================
Oracle HS Trace file:
Oracle Corporation --- WEDNESDAY SEP 01 2010 16:11:19.060
Heterogeneous Agent Release
11.2.0.1.0
Oracle Corporation --- WEDNESDAY SEP 01 2010 16:11:19.059
Version 11.2.0.1.0
Entered hgogprd
HOSGIP for "HS_FDS_TRACE_LEVEL" returned "DEBUG"
Entered hgosdip
setting HS_OPEN_CURSORS to default of 50
setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
setting HS_FDS_RECOVERY_PWD to default value
setting HS_FDS_TRANSACTION_LOG to default of HS_TRANSACTION_LOG
setting HS_IDLE_TIMEOUT to default of 0
setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
setting HS_NLS_NCHAR to default of "AL32UTF8"
setting HS_FDS_TIMESTAMP_MAPPING to default of "DATE"
setting HS_FDS_DATE_MAPPING to default of "DATE"
setting HS_RPC_FETCH_REBLOCKING to default of "ON"
setting HS_FDS_FETCH_ROWS to default of "100"
setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
setting HS_FDS_RSET_RETURN_ROWCOUNT to default of "FALSE"
setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
setting HS_FDS_CHARACTER_SEMANTICS to default of "FALSE"
setting HS_FDS_MAP_NCHAR to default of "TRUE"
setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
setting HS_FDS_QUERY_DRIVER to default of "TRUE"
HOSGIP returned value of "FALSE" for HS_FDS_SUPPORT_STATISTICS
Parameter HS_FDS_QUOTE_IDENTIFIER is not set
setting HS_KEEP_REMOTE_COLUMN_SIZE to default of "OFF"
setting HS_FDS_GRAPHIC_TO_MBCS to default of "FALSE"
setting HS_FDS_MBCS_TO_GRAPHIC to default of "FALSE"
Default value of 64 assumed for HS_FDS_SQLLEN_INTERPRETATION
setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw
$:SQLProcedures;gtw$:SQLStatistics;gtw$:SQLGetInfo"
setting HS_FDS_DELAYED_OPEN to default of "TRUE"
setting HS_FDS_WORKAROUNDS to default of "0"
Exiting hgosdip, rc=0
ORACLE_SID is "myodbc5"
Product-Info:
Port Rls/Upd:1/0 PrdStat:0
Agent:Oracle Database Gateway for ODBC
Facility:hsa
Class:ODBC, ClassVsn:11.2.0.1.0_0008, Instance:myodbc5
Exiting hgogprd, rc=0
Entered hgoinit
HOCXU_COMP_CSET=1
HOCXU_DRV_CSET=31
HOCXU_DRV_NCHAR=873
HOCXU_DB_CSET=873
HOCXU_SEM_VER=112000
Entered hgolofn at 2010/09/01-16:11:19
HOSGIP for "HS_FDS_SHAREABLE_NAME" returned "/usr/local/lib/libodbc.so"
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x159540
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x1596f0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x159f20
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x15b230
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x163420
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x163880
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x1661c0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x1678f0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x168100
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x169c60
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x169c70
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x16b3c0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x16e640
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x16ea00
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x1705e0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x1711d0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x171500
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x1733a0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x173810
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x175870
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x175630
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x15bb50
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x15d4a0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x160e10
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x162cd0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x164400
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x167360
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x168a50
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x169fd0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x16ba60
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x16bfb0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x16d2c0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x16deb0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x16f4a0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x16f760
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x170230
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x171cc0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x1721e0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x1727d0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x172e10
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x173ae0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x176ca0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x1752b0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x1785b0
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Entered hgolofns at 2010/09/01-16:11:19
symbol_peflctx=0x179260
hoaerr:0
Exiting hgolofns at 2010/09/01-16:11:19
Exiting hgolofn, rc=0 at 2010/09/01-16:11:19
HOSGIP for "HS_OPEN_CURSORS" returned "50"
HOSGIP for "HS_FDS_FETCH_ROWS" returned "100"
HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
Invalid value of 64 given for HS_FDS_SQLLEN_INTERPRETATION
treat_SQLLEN_as_compiled = 1
Exiting hgoinit, rc=0 at 2010/09/01-16:11:19
Entered hgolgon at 2010/09/01-16:11:19
reco:0, name:oracle, tflag:0
Entered hgosuec at 2010/09/01-16:11:19
Exiting hgosuec, rc=0 at 2010/09/01-16:11:19
HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
using oracle as default value for "HS_FDS_DEFAULT_OWNER"
HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
Entered hgocont at 2010/09/01-16:11:19
HS_FDS_CONNECT_INFO = "myodbc5"
RC=-1 from HOSGIP for "HS_FDS_CONNECT_STRING"
Entered hgogenconstr at 2010/09/01-16:11:19
dsn:myodbc5, name:oracle
optn:
Entered hgocip at 2010/09/01-16:11:19
dsn:myodbc5
Exiting hgocip, rc=0 at 2010/09/01-16:11:19
Exiting hgogenconstr, rc=0 at 2010/09/01-16:11:19
Entered hgolosf at 2010/09/01-16:11:19
Exiting hgolosf, rc=0 at 2010/09/01-16:11:19
DriverName:libmyodbc5.so, DriverVer:05.01.0007
DBMS Name:MySQL, DBMS Version:5.0.67
Exiting hgocont, rc=0 at 2010/09/01-16:11:19
SQLGetInfo returns Y for SQL_CATALOG_NAME
SQLGetInfo returns 192 for SQL_MAX_CATALOG_NAME_LEN
Exiting hgolgon, rc=0 at 2010/09/01-16:11:19
Entered hgoulcp at 2010/09/01-16:11:19
Entered hgowlst at 2010/09/01-16:11:19
Exiting hgowlst, rc=0 at 2010/09/01-16:11:19
SQLGetInfo returns 0x0 for SQL_OWNER_USAGE
TXN Capable:3, Isolation Option:0xf
SQLGetInfo returns 0 for SQL_MAX_SCHEMA_NAME_LEN
SQLGetInfo returns 192 for SQL_MAX_TABLE_NAME_LEN
SQLGetInfo returns 192 for SQL_MAX_PROCEDURE_NAME_LEN
SQLGetInfo returns ` (0x60) for SQL_IDENTIFIER_QUOTE_CHAR
SQLGetInfo returns Y for SQL_COLUMN_ALIAS
4 instance capabilities will be uploaded
capno:1964, context:0x00000000, add-info: 0
capno:1989, context:0x00000000, add-info: 0
capno:1991, context:0x0001ffff, add-info: 0
capno:1992, context:0x0001ffff, add-info: 1, translation:"`"
Exiting hgoulcp, rc=0 at 2010/09/01-16:11:19
Entered hgouldt at 2010/09/01-16:11:19
NO instance DD translations were uploaded
Exiting hgouldt, rc=0 at 2010/09/01-16:11:19
Entered hgobegn at 2010/09/01-16:11:19
tflag:0 , initial:1
hoi:0x15d8f088, ttid (len 34) is ...
00: 47454D53 2E4C534F 2E4C4F43 414C2E31 [GEMS.LSO.LOCAL.1]
10: 37373837 3164662E 31302E35 342E3533 [77871df.10.54.53]
20: 3938 [98]
tbid (len 31) is ...
00: 47454D53 2E4C534F 2E4C4F43 414C5B31 [GEMS.LSO.LOCAL[1]
10: 302E3534 2E353339 385D5B31 2E345D [0.54.5398][1.4]]
Exiting hgobegn, rc=0 at 2010/09/01-16:11:19
Entered hgodtab at 2010/09/01-16:11:19
count:1
table: mbt_user
Allocate hoada[0] @ 0x7a6440
Entered hgopcda at 2010/09/01-16:11:19
Column:1(user_id): dtype:-5 (BIGINT), prc/scl:19/0, nullbl:1, octet:0, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/01-16:11:19
Entered hgopcda at 2010/09/01-16:11:19
Column:2(email): dtype:12 (VARCHAR), prc/scl:255/0, nullbl:0, octet:255, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/01-16:11:19
Entered hgopcda at 2010/09/01-16:11:19
Column:3(last_logged_in): dtype:93 (TIMESTAMP), prc/scl:19/0, nullbl:1, octet:255, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/01-16:11:19
Entered hgopcda at 2010/09/01-16:11:19
Column:4(mailing_list): dtype:-7 (BIT), prc/scl:1/0, nullbl:1, octet:255, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/01-16:11:19
Entered hgopcda at 2010/09/01-16:11:19
Column:5(password): dtype:-1 (LONGVARCHAR), prc/scl:65535/0, nullbl:0, octet:65535, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/01-16:11:19
The hoada for table mbt_user follows...
hgodtab, line 876: Printing hoada @ 0x7a6440
MAX:5, ACTUAL:5, BRC:1, WHT=6 (TABLE_DESCRIBE)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 255 255 0/ 0 0 0 200 email
91 DATE Y 16 16 0/ 0 0 0 0 last_logged_in
-7 BIT Y 1 1 0/ 0 0 0 20 mailing_list
-1 LONGVARCHAR N 0 0 0/ 0 0 0 220 password
Exiting hgodtab, rc=0 at 2010/09/01-16:11:19
Entered hgodafr, cursor id 0 at 2010/09/01-16:11:19
Free hoada @ 0x7a6440
Exiting hgodafr, rc=0 at 2010/09/01-16:11:19
Entered hgopars, cursor id 1 at 2010/09/01-16:11:19
type:0
SQL text from hgopars, id=1, len=34 ...
00: 53454C45 43542043 4F554E54 282A2920 [SELECT COUNT(*) ]
10: 46524F4D 20606D62 745F7573 65726020 [FROM `mbt_user` ]
20: 4131 [A1]
Exiting hgopars, rc=0 at 2010/09/01-16:11:19
Entered hgoopen, cursor id 1 at 2010/09/01-16:11:19
hgoopen, line 86: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2010/09/01-16:11:19
Entered hgodscr, cursor id 1 at 2010/09/01-16:11:19
Allocate hoada @ 0x7a6440
Entered hgopcda at 2010/09/01-16:11:19
Column:1(COUNT(*)): dtype:-5 (BIGINT), prc/scl:19/0, nullbl:0, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/01-16:11:19
hgodscr, line 880: Printing hoada @ 0x7a6440
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT N 8 8 0/ 0 0 0 20 COUNT(*)
Exiting hgodscr, rc=0 at 2010/09/01-16:11:19
Entered hgoftch, cursor id 1 at 2010/09/01-16:11:19
hgoftch, line 130: Printing hoada @ 0x7a6440
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT N 8 8 0/ 0 0 0 20 COUNT(*)
Performing delayed open.
SQLBindCol: column 1, cdatatype: -25, bflsz: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8, (bfl: 8, mbl: 8)
1 rows fetched
Exiting hgoftch, rc=0 at 2010/09/01-16:11:19
Entered hgoftch, cursor id 1 at 2010/09/01-16:11:19
hgoftch, line 130: Printing hoada @ 0x7a6440
MAX:1, ACTUAL:1, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT N 8 8 0/ 0 0 0 20 COUNT(*)
0 rows fetched
Exiting hgoftch, rc=1403 at 2010/09/01-16:11:19
Entered hgoclse, cursor id 1 at 2010/09/01-16:11:26
Exiting hgoclse, rc=0 at 2010/09/01-16:11:26
Entered hgodafr, cursor id 1 at 2010/09/01-16:11:26
Free hoada @ 0x7a6440
Exiting hgodafr, rc=0 at 2010/09/01-16:11:26
Entered hgopars, cursor id 1 at 2010/09/01-16:11:26
type:0
SQL text from hgopars, id=1, len=49 ...
00: 53454C45 43542041 312E6075 7365725F [SELECT A1.`user_]
10: 6964602C 41312E60 656D6169 6C602046 [id`,A1.`email` F]
20: 524F4D20 606D6274 5F757365 72602041 [ROM `mbt_user` A]
30: 31 [1]
Exiting hgopars, rc=0 at 2010/09/01-16:11:26
Entered hgoopen, cursor id 1 at 2010/09/01-16:11:26
hgoopen, line 86: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2010/09/01-16:11:26
Entered hgodscr, cursor id 1 at 2010/09/01-16:11:26
Allocate hoada @ 0x7a6440
Entered hgopcda at 2010/09/01-16:11:26
Column:1(user_id): dtype:-5 (BIGINT), prc/scl:19/0, nullbl:1, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/01-16:11:26
Entered hgopcda at 2010/09/01-16:11:26
Column:2(email): dtype:12 (VARCHAR), prc/scl:255/0, nullbl:0, octet:255, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/01-16:11:26
hgodscr, line 880: Printing hoada @ 0x7a6440
MAX:2, ACTUAL:2, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 255 255 0/ 0 0 0 200 email
Exiting hgodscr, rc=0 at 2010/09/01-16:11:26
Entered hgoftch, cursor id 1 at 2010/09/01-16:11:26
hgoftch, line 130: Printing hoada @ 0x7a6440
MAX:2, ACTUAL:2, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 255 255 0/ 0 0 0 200 email
Performing delayed open.
SQLBindCol: column 1, cdatatype: -25, bflsz: 8
SQLBindCol: column 2, cdatatype: 1, bflsz: 256
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8, (bfl: 8, mbl: 8)
SQLFetch: row: 1, column 2, bflsz: 256, bflar: 21
SQLFetch: row: 1, column 2, bflsz: 256, bflar: 21, (bfl: 255, mbl: 255)
1 rows fetched
Exiting hgoftch, rc=0 at 2010/09/01-16:11:26
Entered hgoftch, cursor id 1 at 2010/09/01-16:11:26
hgoftch, line 130: Printing hoada @ 0x7a6440
MAX:2, ACTUAL:2, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 21 255 0/ 0 0 0 200 email
0 rows fetched
Exiting hgoftch, rc=1403 at 2010/09/01-16:11:26
Entered hgoclse, cursor id 1 at 2010/09/01-16:11:39
Exiting hgoclse, rc=0 at 2010/09/01-16:11:39
Entered hgodafr, cursor id 1 at 2010/09/01-16:11:39
Free hoada @ 0x7a6440
Exiting hgodafr, rc=0 at 2010/09/01-16:11:39
Entered hgopars, cursor id 1 at 2010/09/01-16:11:39
type:0
SQL text from hgopars, id=1, len=101 ...
00: 53454C45 43542041 312E6075 7365725F [SELECT A1.`user_]
10: 6964602C 41312E60 656D6169 6C602C41 [id`,A1.`email`,A]
20: 312E606C 6173745F 6C6F6767 65645F69 [1.`last_logged_i]
30: 6E602C41 312E606D 61696C69 6E675F6C [n`,A1.`mailing_l]
40: 69737460 2C41312E 60706173 73776F72 [ist`,A1.`passwor]
50: 64602046 524F4D20 606D6274 5F757365 [d` FROM `mbt_use]
60: 72602041 31 [r` A1]
Exiting hgopars, rc=0 at 2010/09/01-16:11:39
Entered hgoopen, cursor id 1 at 2010/09/01-16:11:39
hgoopen, line 86: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2010/09/01-16:11:39
Entered hgodscr, cursor id 1 at 2010/09/01-16:11:39
Allocate hoada @ 0x7a6440
Entered hgopcda at 2010/09/01-16:11:39
Column:1(user_id): dtype:-5 (BIGINT), prc/scl:19/0, nullbl:1, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/01-16:11:39
Entered hgopcda at 2010/09/01-16:11:39
Column:2(email): dtype:12 (VARCHAR), prc/scl:255/0, nullbl:0, octet:255, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/01-16:11:39
Entered hgopcda at 2010/09/01-16:11:39
Column:3(last_logged_in): dtype:93 (TIMESTAMP), prc/scl:19/0, nullbl:1, octet:255, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/01-16:11:39
Entered hgopcda at 2010/09/01-16:11:39
Column:4(mailing_list): dtype:-7 (BIT), prc/scl:1/0, nullbl:1, octet:255, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/01-16:11:39
Entered hgopcda at 2010/09/01-16:11:39
Column:5(password): dtype:-1 (LONGVARCHAR), prc/scl:65535/0, nullbl:0, octet:65535, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/01-16:11:39
hgodscr, line 880: Printing hoada @ 0x7a6440
MAX:5, ACTUAL:5, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 255 255 0/ 0 0 0 200 email
91 DATE Y 16 16 0/ 0 0 0 0 last_logged_in
-7 BIT Y 1 1 0/ 0 0 0 20 mailing_list
-1 LONGVARCHAR N 0 0 0/ 0 0 0 220 password
Exiting hgodscr, rc=0 at 2010/09/01-16:11:39
Entered hgoftch, cursor id 1 at 2010/09/01-16:11:39
hgoftch, line 130: Printing hoada @ 0x7a6440
MAX:5, ACTUAL:5, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 255 255 0/ 0 0 0 200 email
91 DATE Y 16 16 0/ 0 0 0 0 last_logged_in
-7 BIT Y 1 1 0/ 0 0 0 20 mailing_list
-1 LONGVARCHAR N 766 0 0/ 0 0 0 220 password
Performing delayed open.
SQLBindCol: column 1, cdatatype: -25, bflsz: 8
SQLBindCol: column 2, cdatatype: 1, bflsz: 256
SQLBindCol: column 3, cdatatype: 93, bflsz: 16
SQLBindCol: column 4, cdatatype: -28, bflsz: 1
SQLBindCol: column 5, cdatatype: 1, bflsz: 767
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8, (bfl: 8, mbl: 8)
SQLFetch: row: 1, column 2, bflsz: 256, bflar: 21
SQLFetch: row: 1, column 2, bflsz: 256, bflar: 21, (bfl: 255, mbl: 255)
SQLFetch: row: 1, column 3, bflsz: 16, bflar: 16
SQLFetch: row: 1, column 3, bflsz: 16, bflar: 16, (bfl: 16, mbl: 16)
SQLFetch: row: 1, column 4, bflsz: 1, bflar: 1
SQLFetch: row: 1, column 4, bflsz: 1, bflar: 1, (bfl: 1, mbl: 1)
SQLFetch: row: 1, column 5, bflsz: 767, bflar: 40
SQLFetch: row: 1, column 5, bflsz: 767, bflar: 40, (bfl: 766, mbl: 0)
1 rows fetched
Exiting hgoftch, rc=0 at 2010/09/01-16:11:39
Entered hgoftch, cursor id 1 at 2010/09/01-16:11:39
hgoftch, line 130: Printing hoada @ 0x7a6440
MAX:5, ACTUAL:5, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 21 255 0/ 0 0 0 200 email
91 DATE Y 16 16 0/ 0 0 0 0 last_logged_in
-7 BIT Y 1 1 0/ 0 0 0 20 mailing_list
-1 LONGVARCHAR N 766 0 0/ 0 0 0 220 password
0 rows fetched
Exiting hgoftch, rc=1403 at 2010/09/01-16:11:39
Entered hgoclse, cursor id 1 at 2010/09/01-16:11:45
Exiting hgoclse, rc=0 at 2010/09/01-16:11:45
Entered hgodafr, cursor id 1 at 2010/09/01-16:11:45
Free hoada @ 0x7a6440
Exiting hgodafr, rc=0 at 2010/09/01-16:11:45
Entered hgocomm at 2010/09/01-16:11:45
keepinfo:0, tflag:1
00: 47454D53 2E4C534F 2E4C4F43 414C2E31 [GEMS.LSO.LOCAL.1]
10: 37373837 3164662E 31302E35 342E3533 [77871df.10.54.53]
20: 3938 [98]
tbid (len 31) is ...
00: 47454D53 2E4C534F 2E4C4F43 414C5B31 [GEMS.LSO.LOCAL[1]
10: 302E3534 2E353339 385D5B31 2E345D [0.54.5398][1.4]]
cmt(0):
Entered hgocpctx at 2010/09/01-16:11:45
Exiting hgocpctx, rc=0 at 2010/09/01-16:11:45
Exiting hgocomm, rc=0 at 2010/09/01-16:11:45
Entered hgolgof at 2010/09/01-16:11:45
tflag:1
Exiting hgolgof, rc=0 at 2010/09/01-16:11:45
Entered hgoexit at 2010/09/01-16:11:45
Exiting hgoexit, rc=0<h2>This is the scenario where describe table only shows the first field during the first SQLPlus session. I closed the first SQLPlus session, simply opened a new SQLPlus session. Describe table shows all column definitions of MySQL table this time. You can see that there are three records in tracking_list table, however, select * from "tracking_list"@mybilltracker only retruns one record.</h2>
First SQLPlus Session:
SQL> describe "tracking_list"@mybilltracker;
Name Null? Type
list_id NUMBER(20)
SQL> select count(*) from "tracking_list"@mybilltracker;
COUNT(*)
3
SQL> select * from "tracking_list"@mybilltracker;
list_id
1
SQL> describe "tracking_list"@mybilltracker;
Name Null? Type
list_id NUMBER(20)
SQL> exit
========================================
Second SQLPlus Session:
Connected.
SQL> describe "tracking_list"@mybilltracker;
Name Null? Type
list_id NUMBER(20)
last_updt_date DATE
list_create_date DATE
list_name NOT NULL VARCHAR2(255)
list_yr NOT NULL NUMBER(10)
user_id NUMBER(20)
SQL> select count(*) from "tracking_list"@mybilltracker;
COUNT(*)
3
SQL> select * from "tracking_list"@mybilltracker;
list_id last_updt list_crea
list_name
list_yr user_id
1 02-SEP-10 02-SEP-10
List 1
2010 1
SQL> exit
=============================================
HS trace file for the first SQLPlus session:
Oracle Corporation --- THURSDAY SEP 02 2010 09:55:46.523
Heterogeneous Agent Release
11.2.0.1.0
Oracle Corporation --- THURSDAY SEP 02 2010 09:55:46.522
Version 11.2.0.1.0
Entered hgogprd
HOSGIP for "HS_FDS_TRACE_LEVEL" returned "DEBUG"
Entered hgosdip
setting HS_OPEN_CURSORS to default of 50
setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
setting HS_FDS_RECOVERY_PWD to default value
setting HS_FDS_TRANSACTION_LOG to default of HS_TRANSACTION_LOG
setting HS_IDLE_TIMEOUT to default of 0
setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
setting HS_NLS_NCHAR to default of "AL32UTF8"
setting HS_FDS_TIMESTAMP_MAPPING to default of "DATE"
setting HS_FDS_DATE_MAPPING to default of "DATE"
setting HS_RPC_FETCH_REBLOCKING to default of "ON"
setting HS_FDS_FETCH_ROWS to default of "100"
setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
setting HS_FDS_RSET_RETURN_ROWCOUNT to default of "FALSE"
setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
setting HS_FDS_CHARACTER_SEMANTICS to default of "FALSE"
setting HS_FDS_MAP_NCHAR to default of "TRUE"
setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
setting HS_FDS_QUERY_DRIVER to default of "TRUE"
HOSGIP returned value of "FALSE" for HS_FDS_SUPPORT_STATISTICS
Parameter HS_FDS_QUOTE_IDENTIFIER is not set
setting HS_KEEP_REMOTE_COLUMN_SIZE to default of "OFF"
setting HS_FDS_GRAPHIC_TO_MBCS to default of "FALSE"
setting HS_FDS_MBCS_TO_GRAPHIC to default of "FALSE"
Default value of 64 assumed for HS_FDS_SQLLEN_INTERPRETATION
setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw$:SQLProcedures;gtw$:SQLStatistics;gtw$:SQLGetInfo"
setting HS_FDS_DELAYED_OPEN to default of "TRUE"
setting HS_FDS_WORKAROUNDS to default of "0"
Exiting hgosdip, rc=0
ORACLE_SID is "myodbc5"
Product-Info:
Port Rls/Upd:1/0 PrdStat:0
Agent:Oracle Database Gateway for ODBC
Facility:hsa
Class:ODBC, ClassVsn:11.2.0.1.0_0008, Instance:myodbc5
Exiting hgogprd, rc=0
Entered hgoinit
HOCXU_COMP_CSET=1
HOCXU_DRV_CSET=31
HOCXU_DRV_NCHAR=873
HOCXU_DB_CSET=873
HOCXU_SEM_VER=112000
Entered hgolofn at 2010/09/02-09:55:46
HOSGIP for "HS_FDS_SHAREABLE_NAME" returned "/usr/local/lib/libodbc.so"
Entered hgolofns at 2010/09/02-09:55:46
symbol_peflctx=0xdc523540
hoaerr:0
Exiting hgolofns at 2010/09/02-09:55:46
......(repeating .....)
Entered hgolofns at 2010/09/02-09:55:46
symbol_peflctx=0xdc543260
hoaerr:0
Exiting hgolofns at 2010/09/02-09:55:46
Exiting hgolofn, rc=0 at 2010/09/02-09:55:46
HOSGIP for "HS_OPEN_CURSORS" returned "50"
HOSGIP for "HS_FDS_FETCH_ROWS" returned "100"
HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
Invalid value of 64 given for HS_FDS_SQLLEN_INTERPRETATION
treat_SQLLEN_as_compiled = 1
Exiting hgoinit, rc=0 at 2010/09/02-09:55:46
Entered hgolgon at 2010/09/02-09:55:46
reco:0, name:oracle, tflag:0
Entered hgosuec at 2010/09/02-09:55:46
Exiting hgosuec, rc=0 at 2010/09/02-09:55:46
HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
using oracle as default value for "HS_FDS_DEFAULT_OWNER"
HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
Entered hgocont at 2010/09/02-09:55:46
HS_FDS_CONNECT_INFO = "myodbc5"
RC=-1 from HOSGIP for "HS_FDS_CONNECT_STRING"
Entered hgogenconstr at 2010/09/02-09:55:46
dsn:myodbc5, name:oracle
optn:
Entered hgocip at 2010/09/02-09:55:46
dsn:myodbc5
Exiting hgocip, rc=0 at 2010/09/02-09:55:46
Exiting hgogenconstr, rc=0 at 2010/09/02-09:55:46
Entered hgolosf at 2010/09/02-09:55:46
Exiting hgolosf, rc=0 at 2010/09/02-09:55:46
DriverName:libmyodbc5.so, DriverVer:05.01.0007
DBMS Name:MySQL, DBMS Version:5.0.67
Exiting hgocont, rc=0 at 2010/09/02-09:55:46
SQLGetInfo returns Y for SQL_CATALOG_NAME
SQLGetInfo returns 192 for SQL_MAX_CATALOG_NAME_LEN
Exiting hgolgon, rc=0 at 2010/09/02-09:55:46
Entered hgoulcp at 2010/09/02-09:55:46
Entered hgowlst at 2010/09/02-09:55:46
Exiting hgowlst, rc=0 at 2010/09/02-09:55:46
SQLGetInfo returns 0x0 for SQL_OWNER_USAGE
TXN Capable:3, Isolation Option:0xf
SQLGetInfo returns 0 for SQL_MAX_SCHEMA_NAME_LEN
SQLGetInfo returns 192 for SQL_MAX_TABLE_NAME_LEN
SQLGetInfo returns 192 for SQL_MAX_PROCEDURE_NAME_LEN
SQLGetInfo returns ` (0x60) for SQL_IDENTIFIER_QUOTE_CHAR
SQLGetInfo returns Y for SQL_COLUMN_ALIAS
4 instance capabilities will be uploaded
capno:1964, context:0x00000000, add-info: 0
capno:1989, context:0x00000000, add-info: 0
capno:1991, context:0x0001ffff, add-info: 0
capno:1992, context:0x0001ffff, add-info: 1, translation:"`"
Exiting hgoulcp, rc=0 at 2010/09/02-09:55:46
Entered hgouldt at 2010/09/02-09:55:46
NO instance DD translations were uploaded
Exiting hgouldt, rc=0 at 2010/09/02-09:55:46
Entered hgobegn at 2010/09/02-09:55:46
tflag:0 , initial:1
hoi:0x8b4b52f8, ttid (len 34) is ...
00: 47454D53 2E4C534F 2E4C4F43 414C2E31 [GEMS.LSO.LOCAL.1]
10: 37373837 3164662E 33322E36 382E3335 [77871df.32.68.35]
20: 3630 [60]
tbid (len 31) is ...
00: 47454D53 2E4C534F 2E4C4F43 414C5B33 [GEMS.LSO.LOCAL[3]
10: 322E3638 2E333536 305D5B31 2E345D [2.68.3560][1.4]]
Exiting hgobegn, rc=0 at 2010/09/02-09:55:46
Entered hgodtab at 2010/09/02-09:55:46
count:1
table: mbt_user
Allocate hoada[0] @ 0x7a6440
Entered hgopcda at 2010/09/02-09:55:46
Column:1(user_id): dtype:-5 (BIGINT), prc/scl:19/0, nullbl:1, octet:0, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/02-09:55:46
Entered hgopcda at 2010/09/02-09:55:46
Column:2(email): dtype:12 (VARCHAR), prc/scl:255/0, nullbl:0, octet:255, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/02-09:55:46
Entered hgopcda at 2010/09/02-09:55:46
Column:3(last_logged_in): dtype:93 (TIMESTAMP), prc/scl:19/0, nullbl:1, octet:255, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/02-09:55:46
Entered hgopcda at 2010/09/02-09:55:46
Column:4(mailing_list): dtype:-7 (BIT), prc/scl:1/0, nullbl:1, octet:255, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/02-09:55:46
Entered hgopcda at 2010/09/02-09:55:46
Column:5(password): dtype:-1 (LONGVARCHAR), prc/scl:65535/0, nullbl:0, octet:65535, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/02-09:55:46
The hoada for table mbt_user follows...
hgodtab, line 876: Printing hoada @ 0x7a6440
MAX:5, ACTUAL:5, BRC:1, WHT=6 (TABLE_DESCRIBE)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 255 255 0/ 0 0 0 200 email
91 DATE Y 16 16 0/ 0 0 0 0 last_logged_in
-7 BIT Y 1 1 0/ 0 0 0 20 mailing_list
-1 LONGVARCHAR N 0 0 0/ 0 0 0 220 password
Exiting hgodtab, rc=0 at 2010/09/02-09:55:46
Entered hgodafr, cursor id 0 at 2010/09/02-09:55:46
Free hoada @ 0x7a6440
Exiting hgodafr, rc=0 at 2010/09/02-09:55:46
Entered hgopars, cursor id 1 at 2010/09/02-09:55:52
type:0
SQL text from hgopars, id=1, len=101 ...
00: 53454C45 43542041 312E6075 7365725F [SELECT A1.`user_]
10: 6964602C 41312E60 656D6169 6C602C41 [id`,A1.`email`,A]
20: 312E606C 6173745F 6C6F6767 65645F69 [1.`last_logged_i]
30: 6E602C41 312E606D 61696C69 6E675F6C [n`,A1.`mailing_l]
40: 69737460 2C41312E 60706173 73776F72 [ist`,A1.`passwor]
50: 64602046 524F4D20 606D6274 5F757365 [d` FROM `mbt_use]
60: 72602041 31 [r` A1]
Exiting hgopars, rc=0 at 2010/09/02-09:55:52
Entered hgoopen, cursor id 1 at 2010/09/02-09:55:52
hgoopen, line 86: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2010/09/02-09:55:52
Entered hgodscr, cursor id 1 at 2010/09/02-09:55:52
Allocate hoada @ 0x7a63a0
Entered hgopcda at 2010/09/02-09:55:52
Column:1(user_id): dtype:-5 (BIGINT), prc/scl:19/0, nullbl:1, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/02-09:55:52
Entered hgopcda at 2010/09/02-09:55:52
Column:2(email): dtype:12 (VARCHAR), prc/scl:255/0, nullbl:0, octet:255, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/02-09:55:52
Entered hgopcda at 2010/09/02-09:55:52
Column:3(last_logged_in): dtype:93 (TIMESTAMP), prc/scl:19/0, nullbl:1, octet:255, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/02-09:55:52
Entered hgopcda at 2010/09/02-09:55:52
Column:4(mailing_list): dtype:-7 (BIT), prc/scl:1/0, nullbl:1, octet:255, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/02-09:55:52
Entered hgopcda at 2010/09/02-09:55:52
Column:5(password): dtype:-1 (LONGVARCHAR), prc/scl:65535/0, nullbl:0, octet:65535, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/02-09:55:52
hgodscr, line 880: Printing hoada @ 0x7a63a0
MAX:5, ACTUAL:5, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 255 255 0/ 0 0 0 200 email
91 DATE Y 16 16 0/ 0 0 0 0 last_logged_in
-7 BIT Y 1 1 0/ 0 0 0 20 mailing_list
-1 LONGVARCHAR N 0 0 0/ 0 0 0 220 password
Exiting hgodscr, rc=0 at 2010/09/02-09:55:52
Entered hgoftch, cursor id 1 at 2010/09/02-09:55:52
hgoftch, line 130: Printing hoada @ 0x7a63a0
MAX:5, ACTUAL:5, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 255 255 0/ 0 0 0 200 email
91 DATE Y 16 16 0/ 0 0 0 0 last_logged_in
-7 BIT Y 1 1 0/ 0 0 0 20 mailing_list
-1 LONGVARCHAR N 766 0 0/ 0 0 0 220 password
Performing delayed open.
SQLBindCol: column 1, cdatatype: -25, bflsz: 8
SQLBindCol: column 2, cdatatype: 1, bflsz: 256
SQLBindCol: column 3, cdatatype: 93, bflsz: 16
SQLBindCol: column 4, cdatatype: -28, bflsz: 1
SQLBindCol: column 5, cdatatype: 1, bflsz: 767
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8, (bfl: 8, mbl: 8)
SQLFetch: row: 1, column 2, bflsz: 256, bflar: 21
SQLFetch: row: 1, column 2, bflsz: 256, bflar: 21, (bfl: 255, mbl: 255)
SQLFetch: row: 1, column 3, bflsz: 16, bflar: 16
SQLFetch: row: 1, column 3, bflsz: 16, bflar: 16, (bfl: 16, mbl: 16)
SQLFetch: row: 1, column 4, bflsz: 1, bflar: 1
SQLFetch: row: 1, column 4, bflsz: 1, bflar: 1, (bfl: 1, mbl: 1)
SQLFetch: row: 1, column 5, bflsz: 767, bflar: 40
SQLFetch: row: 1, column 5, bflsz: 767, bflar: 40, (bfl: 766, mbl: 0)
1 rows fetched
Exiting hgoftch, rc=0 at 2010/09/02-09:55:52
Entered hgoftch, cursor id 1 at 2010/09/02-09:55:52
hgoftch, line 130: Printing hoada @ 0x7a63a0
MAX:5, ACTUAL:5, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY,0x200:TREAT_AS_CHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 user_id
12 VARCHAR N 21 255 0/ 0 0 0 200 email
91 DATE Y 16 16 0/ 0 0 0 0 last_logged_in
-7 BIT Y 1 1 0/ 0 0 0 20 mailing_list
-1 LONGVARCHAR N 766 0 0/ 0 0 0 220 password
0 rows fetched
Exiting hgoftch, rc=1403 at 2010/09/02-09:55:52
Entered hgoclse, cursor id 1 at 2010/09/02-09:56:16
Exiting hgoclse, rc=0 at 2010/09/02-09:56:16
Entered hgodafr, cursor id 1 at 2010/09/02-09:56:16
Free hoada @ 0x7a63a0
Exiting hgodafr, rc=0 at 2010/09/02-09:56:16
Entered hgopars, cursor id 1 at 2010/09/02-09:56:16
type:0
SQL text from hgopars, id=1, len=34 ...
00: 53454C45 43542043 4F554E54 282A2920 [SELECT COUNT(*) ]
10: 46524F4D 20606D62 745F7573 65726020 [FROM `mbt_user` ]
20: 4131 [A1]
Exiting hgopars, rc=0 at 2010/09/02-09:56:16
Entered hgoopen, cursor id 1 at 2010/09/02-09:56:16
hgoopen, line 86: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2010/09/02-09:56:16
Entered hgodscr, cursor id 1 at 2010/09/02-09:56:16
Allocate hoada @ 0x7a63a0
Entered hgopcda at 2010/09/02-09:56:16
Column:1(COUNT(*)): dtype:-5 (BIGINT), prc/scl:19/0, nullbl:0, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/02-09:56:16
hgodscr, line 880: Printing hoada @ 0x7a63a0
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT N 8 8 0/ 0 0 0 20 COUNT(*)
Exiting hgodscr, rc=0 at 2010/09/02-09:56:16
Entered hgoftch, cursor id 1 at 2010/09/02-09:56:16
hgoftch, line 130: Printing hoada @ 0x7a63a0
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT N 8 8 0/ 0 0 0 20 COUNT(*)
Performing delayed open.
SQLBindCol: column 1, cdatatype: -25, bflsz: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8, (bfl: 8, mbl: 8)
1 rows fetched
Exiting hgoftch, rc=0 at 2010/09/02-09:56:16
Entered hgoftch, cursor id 1 at 2010/09/02-09:56:16
hgoftch, line 130: Printing hoada @ 0x7a63a0
MAX:1, ACTUAL:1, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT N 8 8 0/ 0 0 0 20 COUNT(*)
0 rows fetched
Exiting hgoftch, rc=1403 at 2010/09/02-09:56:16
Entered hgodtab at 2010/09/02-10:03:18
count:1
table: tracking_list
Allocate hoada[0] @ 0x7ebbd0
Entered hgopcda at 2010/09/02-10:03:18
Column:1(list_id): dtype:-5 (BIGINT), prc/scl:19/0, nullbl:1, octet:0, sign:1, radix:10
Exiting hgopcda, rc=0 at 2010/09/02-10:03:18
The hoada for table tracking_list follows...
hgodtab, line 876: Printing hoada @ 0x7ebbd0
MAX:1, ACTUAL:1, BRC:1, WHT=6 (TABLE_DESCRIBE)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 list_id
Exiting hgodtab, rc=0 at 2010/09/02-10:03:18
Entered hgodafr, cursor id 0 at 2010/09/02-10:03:18
Free hoada @ 0x7ebbd0
Exiting hgodafr, rc=0 at 2010/09/02-10:03:18
Entered hgoclse, cursor id 1 at 2010/09/02-10:06:11
Exiting hgoclse, rc=0 at 2010/09/02-10:06:11
Entered hgodafr, cursor id 1 at 2010/09/02-10:06:11
Free hoada @ 0x7a63a0
Exiting hgodafr, rc=0 at 2010/09/02-10:06:11
Entered hgopars, cursor id 1 at 2010/09/02-10:06:11
type:0
SQL text from hgopars, id=1, len=39 ...
00: 53454C45 43542043 4F554E54 282A2920 [SELECT COUNT(*) ]
10: 46524F4D 20607472 61636B69 6E675F6C [FROM `tracking_l]
20: 69737460 204131 [ist` A1]
Exiting hgopars, rc=0 at 2010/09/02-10:06:11
Entered hgoopen, cursor id 1 at 2010/09/02-10:06:11
hgoopen, line 86: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2010/09/02-10:06:11
Entered hgodscr, cursor id 1 at 2010/09/02-10:06:11
Allocate hoada @ 0x7a63e8
Entered hgopcda at 2010/09/02-10:06:11
Column:1(COUNT(*)): dtype:-5 (BIGINT), prc/scl:19/0, nullbl:0, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/02-10:06:11
hgodscr, line 880: Printing hoada @ 0x7a63e8
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT N 8 8 0/ 0 0 0 20 COUNT(*)
Exiting hgodscr, rc=0 at 2010/09/02-10:06:11
Entered hgoftch, cursor id 1 at 2010/09/02-10:06:11
hgoftch, line 130: Printing hoada @ 0x7a63e8
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT N 8 8 0/ 0 0 0 20 COUNT(*)
Performing delayed open.
SQLBindCol: column 1, cdatatype: -25, bflsz: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8, (bfl: 8, mbl: 8)
1 rows fetched
Exiting hgoftch, rc=0 at 2010/09/02-10:06:11
Entered hgoftch, cursor id 1 at 2010/09/02-10:06:11
hgoftch, line 130: Printing hoada @ 0x7a63e8
MAX:1, ACTUAL:1, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT N 8 8 0/ 0 0 0 20 COUNT(*)
0 rows fetched
Exiting hgoftch, rc=1403 at 2010/09/02-10:06:11
Entered hgoclse, cursor id 1 at 2010/09/02-10:06:20
Exiting hgoclse, rc=0 at 2010/09/02-10:06:20
Entered hgodafr, cursor id 1 at 2010/09/02-10:06:20
Free hoada @ 0x7a63e8
Exiting hgodafr, rc=0 at 2010/09/02-10:06:20
Entered hgopars, cursor id 1 at 2010/09/02-10:06:20
type:0
SQL text from hgopars, id=1, len=43 ...
00: 53454C45 43542041 312E606C 6973745F [SELECT A1.`list_]
10: 69646020 46524F4D 20607472 61636B69 [id` FROM `tracki]
20: 6E675F6C 69737460 204131 [ng_list` A1]
Exiting hgopars, rc=0 at 2010/09/02-10:06:20
Entered hgoopen, cursor id 1 at 2010/09/02-10:06:20
hgoopen, line 86: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2010/09/02-10:06:20
Entered hgodscr, cursor id 1 at 2010/09/02-10:06:20
Allocate hoada @ 0x7a6440
Entered hgopcda at 2010/09/02-10:06:20
Column:1(list_id): dtype:-5 (BIGINT), prc/scl:19/0, nullbl:1, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/09/02-10:06:20
hgodscr, line 880: Printing hoada @ 0x7a6440
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 list_id
Exiting hgodscr, rc=0 at 2010/09/02-10:06:20
Entered hgoftch, cursor id 1 at 2010/09/02-10:06:20
hgoftch, line 130: Printing hoada @ 0x7a6440
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 list_id
Performing delayed open.
SQLBindCol: column 1, cdatatype: -25, bflsz: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8
SQLFetch: row: 1, column 1, bflsz: 8, bflar: 8, (bfl: 8, mbl: 8)
1 rows fetched
Exiting hgoftch, rc=0 at 2010/09/02-10:06:20
Entered hgoftch, cursor id 1 at 2010/09/02-10:06:20
hgoftch, line 130: Printing hoada @ 0x7a6440
MAX:1, ACTUAL:1, BRC:1, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x20:NEGATIVE_HOADADTY)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
-5 BIGINT Y 8 8 0/ 0 0 0 20 list_id
0 rows fetched
Exiting hgoftch, rc=1403 at 2010/09/02-10:06:20
Entered hgoclse, cursor id 1 at 2010/09/02-10:06:55
Exiting hgoclse, rc=0 at 2010/09/02-10:06:55
Entered hgodafr, cursor id 1 at 2010/09/02-10:06:55
Free hoada @ 0x7a6440
Exiting hgodafr, rc=0 at 2010/09/02-10:06:55
Entered hgocomm at 2010/09/02-10:06:55
keepinfo:0, tflag:1
00: 47454D53 2E4C534F 2E4C4F43 414C2E31 [GEMS.LSO.LOCAL.1]
10: 37373837 3164662E 33322E36 382E3335 [77871df.32.68.35]
20: 3630 [60]
tbid (len 31) is ...
00: 47454D53 2E4C534F 2E4C4F43 414C5B33 [GEMS.LSO.LOCAL[3]
10: 322E3638 2E333536 305D5B31 2E345D [2.68.3560][1.4]]
cmt(0):
Entered hgocpctx at 2010/09/02-10:06:55
Exiting hgocpctx, rc=0 at 2010/09/02-10:06:55
Exiting hgocomm, rc=0 at 2010/09/02-10:06:55
Entered hgolgof at 2010/09/02-10:06:55
tflag:1
Exiting hgolgof, rc=0 at 2010/09/02-10:06:55
Entered hgoexit at 2010/09/02-10:06:55
Exiting hgoexit, rc=0 -
Return only one record at a time
I am new to crystal reports so any help would be appreciated. I have a .net app that is a order processing system. When the user is in a record, they want to be able to click on a button an open a crystal report showing only that orders details. I created a crystal report that has the following fields:
Order ID, Product ID, Unit Price, Sell Price, Hours.
The Order ID is the primary key in the database. The report runs fine when clicking the report button in the app, but returns the details for every order in the database. We just need the details of the order that the user is processing. How do I setup the report to only show that order's details? I am using VB 2005 and Crystal v9.
Edited by: sking on Mar 6, 2009 1:12 AMBrian,
Thank you for all your help. I have been able to setup the report to return only one record at a time. In my app, when I click the report button the PDF opens perfectly with only one record. However, when I go to another record and open the PDF it returns the information from the record id that was set as the default parameter value (crReportDocument.SetParameterValue("Orders", 67). How do I get it to return the report for a different record? Here is the code I'm using. I think I'm really close with your suggestions but I'm just missing one step.
#Region "CrystalReport"
''' <summary>
'''Override the CrystalReportButton_Click and call DisplayReportAsPDF_CrystalReportButton function
''' </summary>
Public Sub CrystalReportButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim crReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim fileName As String = "test.rpt"
Try
If fileName.Substring(1).StartsWith(":\") Then
crReportDocument.Load(fileName)
Else
crReportDocument.Load(Me.Page.MapPath(fileName))
End If
Catch ex As Exception
Dim errMsg As String = ex.Message.Replace(Chr(13).ToString(), "").Replace(Chr(10).ToString(), "")
errMsg += " Please make sure the dlls for Crystal Report are compatible with the Crystal Report file."
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", errMsg)
End Try
Try
Dim paramValue As CrystalDecisions.Shared.ParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue()
paramValue.Value = "67"
crReportDocument.SetParameterValue("Orders", 67)
DisplayReportAsPDF_CrystalReportButton(crReportDocument)
Catch ex As Exception
Dim errMsg As String = ex.Message.Replace(Chr(13).ToString(), "").Replace(Chr(10).ToString(), "")
errMsg += " If this is a deployment machine, make sure network service has permissions to read or write to the windows\temp folder."
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", errMsg)
End Try -
Need to return only one record from select statement.
Hello friends,
I have a scenerio in which code only want to fetch one value from the SQL statement, but in some cases the statment return more then one row due to which ORA-01422 : Exact fetch return more then one row, error comes.
Can you suggest me to write a select statement that will handel this. I am using the below mentioned select statement:
EXECUTE IMMEDIATE
'SELECT rsdn FROM ' || schema || '.table_name' ||
' WHERE a = :1 AND b = :2 AND c IN (32,33,34)'
INTO v_rsdn USING v_a, v_b;
One question, Can I use Rownum < 2 in Where clause to restrict the select output to only one record ? Please suggest ?
Regards,
RajatWell, if rownum=1 could be a trash answer, it would be an issue since we don't know which record you are interested to. Is it one particular ? Is it only to workaround the issue ? Then you may want to manage some BULK COLLECT or whatever else array to receive all the rows as well.
What are you doing with the rows returned ?
Nicolas. -
Need help in SQL query to get only distinct records
Hi all.
I am new to oracle SQL and i want to write a query to get only distinct values from 2 tables.
for example i hade 2 tables table1(employee_id,employee_no,grade) and another table2 with same structure.
for example data in table1 is
Employeeid employeeno Grade
1 101 A
1 101 B
1 101 E
1 101 D
and data in table 2 is
Employeeid employeeno Grade
1 101 A
1 101 B
1 101 E
i want to display only the fourth row like the data that doesnt exist in table2 i,e (1 101 D)
I had too much records in both tables and i jst want to see the records that is in table 1 not in table 2 only.
employeeid and employeeno are the same in both tables
I hope u understand my query. I user left outer join and right outer join bt it displays all the results that and matching and unmatching. I want jst unmatched records.
Any help is highly Appreciated.
Thanx in Advance.
I am using oracle 10G on windowsTry MINUS:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries004.htm#i2054381
SQL> -- generating sample data:
SQL> with t1 as (
2 select 1 employeeid, 101 employeeno, 'A' grade from dual union
3 select 1, 101, 'B' from dual union
4 select 1, 101, 'E' from dual union
5 select 1, 101, 'D' from dual
6 )
7 , t2 as (
8 select 1 employeeid, 101 employeeno, 'A' grade from dual union
9 select 1, 101, 'B' from dual union
10 select 1, 101, 'E' from dual
11 )
12 --
13 -- actual query:
14 --
15 select employeeid
16 , employeeno
17 , grade
18 from t1
19 minus
20 select employeeid
21 , employeeno
22 , grade
23 from t2;
EMPLOYEEID EMPLOYEENO G
1 101 D
1 row selected. -
Sql query to Load only new records,or update old records
Hi,
I need a query (not stored procedure) to insert only new records otherwise update existing records.
I tried by creating "Merge statement in SQl", but the sql query is wrong,it is not updating,always inserting records(replicating..1,2,4,8,16,32..).
below is my sample query,
Here "FACT_mytbl -FCT" is my fact table.(which need to update if already records found ,otherwise insert as new records).
*Inside select ---the table E_tbl1,E_tbl2 is the business logic table ,using this two table only ,"FACT_mytbl" was created .So the "S" alias will be the source
table and "FCT" will be target table. based on this we have to insert or update records.
---Query starts-------------------------------------
MERGE INTO [FACT_mytbl] FCT
USING (
SELECT
FCT1.ID
,FCT1.PKcol1
,FCT1.FKcol1
,FCT1.col1
,FCT1.col2
, FCT1.col3
FROM [FACT_mytbl] FCT1 WITH(NOLOCK)
LEFT JOIN dbo.E_tbl1 CT WITH(NOLOCK)
ON CT.PKcol1=FCT1.PKcol1
LEFT JOIN dbo.E_tbl2 CT1 WITH(NOLOCK)
ON CT1.PKcol1=FCT1.PKcol1
) S
ON FCT.PKcol1 = S.PKcol1
WHEN MATCHED AND (FCT.PKcol1 ! = S.PKcol1 ) THEN
UPDATE SET
FCT.col1
,FCT.col2
,FCT.col3
WHEN NOT MATCHED THEN
INSERT VALUES
S.ID
,S.PKcol1
,S.FKcol1
,S.col1
,S.col2
, S.col3
--query ends----------------
any suggestions,
Thanks,
R.BHi Bhupesh_Rajasekaran,
According to your description, if you want to insert only new records which does not exist in destination and update existing records which does exist in destination. We usually accomplish these in two statement.
1.A join statement to update records.
2.A insert statement for new records.
Also we can use MERGE in SQL Server to insert, update at the same time. You specify a "Source" record set and a "Target" table, and the join between the two. You then specify the type of data modification that is to occur when the records between the two
data are matched or are not matched. For more information, there is an similar example about merge in SQL Server, you can review the following article.
http://www.codeproject.com/Tips/590085/Merge-in-SQL-Server
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
SQL query that returns exclusive rows from groups
I'm using modified scott/tiger data for this.
I've got two tables
DEPT_X
DEPTNO DNAME LOC CODE_ID SUB_DEPTNO
10 ACCOUNTING NEW YORK 111 101
10 SALES ATWN 111 102
10 SALES BTWN 112 103
20 RESEARCH DALLAS 111 201
20 RESEARCH CTWN 111 202
30 SALES CHICAGO 111 301
40 OPERATIONS BOSTON 112 401and
BI_PD
CODE_ID PD_TYPE BI_TYPE
111 -1
112 -1 I want to write a query that joins the code_ids of the two tables and lists out either only the records from DEPT_X who's code_ids have a -1 in the PD_TYPE(112) column and none of the code_ids that have a -1 in the BI_TYPE(111) column for each department or if that department has code_ids for the BI_TYPE (111), list out those rows. So for Deptno 10 you'll only get the row with SUB_DEPTNO = 103. But if for that DEPTNO= 20 you'll get the rows for both SUB_DEPTNO = 201 and 202.
So the result should look like
DEPTNO SUB_DEPTNO
10 103
20 201
20 202
30 301.
Basically I just want rows from each department that have code_ids = 111 not to show up if there are code_ids = 112.
What is the query to do this?
Message was edited by:
user623359
Message was edited by:
user623359
Message was edited by:
user623359
Message was edited by:
user623359
Message was edited by:
user623359One way could be:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> with dept_x as (
2 select 10 deptno, 'ACCOUNTING' dname, 'NEW YORK' loc, 111 code_id, 101 sub_deptno from dual
union all
3 select 10, 'SALES', 'ATWN', 111, 102 from dual union all
4 select 10, 'SALES', 'BTWN', 112, 103 from dual union all
5 select 20, 'RESEARCH', 'DALLAS', 111, 201 from dual union all
6 select 20, 'RESEARCH', 'CTWN', 111, 202 from dual union all
7 select 30, 'SALES', 'CHICAGO', 111, 301 from dual union all
8 select 40, 'OPERATIONS', 'BOSTON', 112, 401 from dual ),
9 --
10 bi_pd as(
11 select 111 code_id, null pd_type, -1 bi_type from dual union all
12 select 112, -1, null from dual),
13 --
14 t as(
15 select a.deptno,a.sub_deptno from dept_x a, bi_pd b
16 where a.code_id = b.code_id and b.pd_type = -1)
17 --
18 select a.deptno,a.sub_deptno
19 from dept_x a, bi_pd b
20 where a.code_id = b.code_id and b.bi_type = -1 and
21 (a.deptno) not in (select deptno from t)
22 union
23 select deptno,sub_deptno from t;
DEPTNO SUB_DEPTNO
10 103
20 201
20 202
30 301
40 401 -
SQL Command returns multiple records, but I see only one record in report
I work with Crystal Reports XI R2 SP3 and Oracle 10g R2 database.
I have an SQL Command that returns multiple records. Command name is "CommDivisionNames" and it returns column "CommDivisionNames.DIVISION_NAME". When I place this field into report details section of the report, I can see all 10 records returned and this is how it should be. I actually need this field to be placed in the report header section, and when I place the field there, then I see only the first record. I set that field as "can grow = true". When I do "browse field data" for this field, I see that all 10 records are there, but only the first one is displayed in report header section.
I thought that I can place SQL Command field anywhere on the report (page header, footer, details) and that it will always show all records that it returns from the database. Can that be done?
My "main part" of the report returns different set of records, and that's what I have in "report details" section. I need this list of divisions to be in the report header section, so user can see that the report was executed for DivA, DivC, DivE.
Thank you,
Milansharonamt:
Users select divisions from parameter, but the parameter multi values are division_numbers (1,5,10), not division_names. Division_names are visible in parameter_prompt_window as description, but parameter remembers only numbers and I don't know how I can reuse division_names later in formula.
I do join for division_numbers and make them into one string variable and pass to sub-report, but I think that I can only get these division_names by calling an SQL command or calling stored procedure.
If I try to do join({MySQLcommand.DIVISION_NAME}) I get error message "A string array is required here".
Carl:
I'm playing with cross-tab and I can use it to see all division_names in the report-header section. Since I need them in only one column or only one row, I have to edit cross-tab object and turn all unneeded border lines to white to make them look invisible. So, cross-tab could be a solution for my problem here.
Another option could be to re-write my SQL command. Since I've read here that SQL command could be written in the same way as I would write a stored procedure, then I could use a bit more complex code to get all multiple division names from the database table into a local cursor, and then use do-while loop to concatenate them into one string, and then to return that string as one record (like 'DivA, DivB, DivC'), and then it should not be a problem to display only that one record/string in report header. It is my understanding that Crystal Reports can call stored procedure that works with many cursors/recordsets and CR will use only the last recordset from the stored procedure. Do you think it could be done this way?
Thank you,
Milan -
I need that this query return only one value
Hi, please. I need your help. I have this query:
SELECT c.charvalue "Comentario", max(pi.id) as "id" --into :gcpe_last_comment
FROM twflprocessinstances pi, twfliprocessparameters c
WHERE pi.id = c.iprocess_id
AND c.param_id = 1002286
AND c.charvalue IS NOT NULL
AND pi.processdef_id = 1600
AND to_number(pi.id) <> 3817940
AND to_number(pi.seeparameter1) =80137377
group by c.charvalue
having max(pi.id)
This query return 3 rows, but I need that this query return only one row. The row that this query should return is the row before at the max id. ThanksMmmm...I don't get it.
You might need to post some sample data and expected results. -
I need a query that returns the average amount of characters for a text colum in MS SQL.
I need a query that returns the average amount of characters
for a text colum in MS SQL.
Could someone show me how?Sorted, i need the
DATALENGTH
function -
Hi
I am trying to wright a SQL query that will return the date the timesheet was submitted and date/time it was approved, can anyone guide me on this?
I basically need person name who submitted, date - time it was submitted for approval, then the person who approved it and the date - time that it was approved
Thanks
RubyRuby,
you can start with HXC_TIMECARD_SUMMARY table for submitter detail. But for approver details, i think you need WF tables to get the data for item type HXCEMP. -
How to use data in a ResultSet when only one record in set?
Hi.
Using a prepared statement which invokes a SELECT * from <table> where <primary key> = <unique value>.
This is executed and the results sent to a resultSet.
The only problem is that only one entry is in the resultSet. I want to parse the results and invoke a new class based on the results.
So I have:
statement = conn.prepareStatement ("SELECT First_Name, Last_Name, Street, Unit, City, Province, Postal_Code" +
" from Customer where CustomerID = ?");
statement.setInt (1, custID);
rset = statement.executeQuery();
rset.next();
cust = new Customer (custID,
rset.getString ("First_Name"),
rset.getString ("Last_Name"),
rset.getString ("Street"),
rset.getString ("Unit"),
rset.getString ("City"),
rset.getString ("Province"),
rset.getString ("Postal_Code"));
statement.close();
rset is a ResultSet. And I'm pretty sure that something like this is WRONG. But one thing I want to know, is there ANY way to properly parse a resultset with only one record?
Thanks.I think I should clarify what I was doing: I'm trying to insert a record into a table, and with the ID that I obtain, use it to retrieve the data.
I did put a commit in there, but someone suggested that the commit won't work in this scenario.
Here is bits of the code that I'm using. By the time insertCustomer is invoked, custID is already populated. The insert works because I checked the table afterwards using a sql query and all my entries posted are there.
private void insertCustomer (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
Connection conn = null;
PreparedStatement statement = null;
try {
conn = DriverManager.getConnection (url, userid, password);
statement = conn.prepareStatement ("INSERT INTO CUSTOMER (CustomerID, First_Name, Last_Name," +
" Street, Unit, City, Province, Postal_Code) values (?, ?, ?, ?, ?, ?, ?, ?)");
statement.setInt (1, custID);
statement.setString (2, firstname);
statement.setString (3, lastname);
statement.setString (4, address);
statement.setString (5, unit);
statement.setString (6, city);
statement.setString (7, province);
statement.setString (8, postalcode);
statement.executeUpdate();
conn.commit();
statement.close();
catch (SQLException e)
throw new ServletException (e);
finally
try
if(statement != null)
statement.close();
if(conn != null)
conn.close();
catch (SQLException e)
throw new ServletException(e);
private String getCustRec (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
Connection conn = null;
PreparedStatement statement = null;
ResultSet rset = null;
CustomerJDBC cust = null;
try
conn = DriverManager.getConnection (url, userid, password);
statement = conn.prepareStatement ("SELECT First_Name, Last_Name, Street, Unit, City, Province, Postal_Code" +
" from Customer where CustomerID = ?");
statement.setInt (1, custID);
rset = statement.executeQuery();
rset.next();
cust = new CustomerJDBC (custID,
rset.getString ("First_Name"),
rset.getString ("Last_Name"),
rset.getString ("Street"),
rset.getString ("Unit"),
rset.getString ("City"),
rset.getString ("Province"),
rset.getString ("Postal_Code"));
statement.close();
catch (SQLException e)
throw new ServletException (e);
finally
try
if(statement != null)
statement.close();
if(conn != null)
conn.close();
catch (SQLException e)
throw new ServletException(e);
return "/CustomerCreatedJDBC.jsp";
}The Constructor method of the class CustomerJDBC appears something like this:
public CustomerJDBC (int id, String fname, String lname, String addr, String unit, String city, String prov, String pcode)
this.custID = id;
this.firstname = fname;
this.lastname = lname;
this.address = addr;
this.unit = unit;
this.city = city;
this.province = prov;
this.postalcode = pcode;
}Thanks for your help.
Edited by: tahna_los on Nov 16, 2008 11:49 PM -
Stacked Bar Not Showing With Only One Record
I have created a stacked bar chart using SQL Server Report Builder 3.0. When the recordset returns more than one record the graph presents correctly. When the recordset contains only one record nothing is displayed. This appears to be a
bug with the product though it is possible I am configuring something incorrectly. Wondering if anyone has had similar experiences or has any insights.
Thanks,
Nick
NickHi Nick,
I create a simple report in my test environment. However, I cannot reproduce it.
Please refer to the following situation to troubleshooting this issue:
1. Please check if you have correct expression in the chart. And if you can query correct data in the dataset.
2. Please check line color of the chart. Make sure it is white.
3. If the field in the Values dialog box is not integer data type, we will lose data in the chart.
If the issue is persist, could you please post the screenshot about your chart design, and your dataset with sample data? It is benefit for us to do further analysis.
Regards,
Alisa Tang
If you have any feedback on our support, please click
here.
Alisa Tang
TechNet Community Support -
Need validation that ensures only one item has a value.
Hello,
I need a validation that ensures that only one item has a value. I want to allow a person entering information into a form to have the option to either select from a drop-down or enter something into a text box but not both.
I have found some information about validation of this type but I'm not sure how to use it. Here is what I found:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This validation ensures that only one item (ITEM_1, ITEM_2) has a value.
Example 5:
Assume a function similar to the following exists:
create or replace function sampleValidation (p_arg in varchar2) return boolean
as
begin
if p_arg= '1' then
return true;
else
return false;
end if;
end;
A validation of type PL/SQL Expression could then reference this function returning a boolean using the following syntax:
sampleValidation(v('MY_ITEM'))
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please let me know how to implement this or give me another way to validate.
Thanks
LindaLinda,
The best is to use a Validation of type PL/SQL Function Returning Error Text like this:
BEGIN
IF :p1_item_1 IS NULL AND :p1_item_2 IS NULL
THEN
RETURN 'One of the items must have a value.';
ELSIF :p1_item_1 IS NOT NULL AND :p1_item_2 IS NOT NULL
THEN
RETURN 'Only one of the items must have a value.';
END IF;
END;Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Request.getParameter("checkbox") Returns only one value
Hello Friends,
I have a very urgent problem on live site. I moved my project from jrun2.3.3 to Jrun 3.1 and I was using multiple select and checkboxes.
With Jrun3.1 if you select multiple select or multiple checkboxes it returns only one value instead of all the values.
Any help is hightly appreciated.If multiple checkboxes have the same name, when selected and submitted, it will pass all values. But you will need to access those using getParameterValues("checkboxname") not getParameter("checkboxname"). The same goes for select elements.
Perhaps it was a bug in JRun 2.3.3 that allowed you to reference all parameter values using just the getParameter("xxx") method.
Maybe you are looking for
-
How can i share a slideshow containing @ 200 pictures and music with 8 friends? can i email it to them?
-
Problem in displaying msg:Concatenate
Hello Friends, Problem in displaying msg.Following is the code: lv_display = 'This is equipment Number'. CONCATENATE lv_display ls_bapi_equip_display-EQUIPMENT into lv_FDisplay . wd_this->DISPLAY_ERROR( EXPORTING msg_text = lv_FDisplay
-
Validate Standard ECC Procurement Reports for BI Procurement Report
Hi Experts, Are there any standard SAP reports whereby I can find the: Acquisition, operation, maintenance and disposal costs of an Equipment/Asset by procurement cost type, Acquisition, operation, maintenance and disposal costs by an Equipment/Asset
-
Help witht the following download
What do I need to download to do the following: To view the full contents of this document, you need a later version of the PDF viewer. You can upgrade to the latest version of Adobe Reader from www.adobe.com/products/acrobat/readstep2.html For furth
-
Problem while archiving a smartform
Dear All, We have implemented records management and in GMGRANT tcode, we created button and which would create a smartform when we press that. Based on the Archive link settings from OAAD tcode, when ever we try to archive that smartform, it wou