Query LPAR in oracle database.
Hi Folks
I was assigned to query LPAR and user_id in some databases. Based on the info on excel sheet, we are going to match up LPARs with physicals servers, and I’ll then determine how many unique database ids exist across each physical server.
I knew how to query user_id`s, but how do I query LPAR info along with user_id`s and putting it in excel sheet?
986269 wrote:
Hi Folks
I was assigned to query LPAR and user_id in some databases. Based on the info on excel sheet, we are going to match up LPARs with physicals servers, and I’ll then determine how many unique database ids exist across each physical server.
I knew how to query user_id`s, but how do I query LPAR info along with user_id`s and putting it in excel sheet?your terminology isnt making sense here, you sure youre talking about Oracle?
whats your database and version? define lpar and user_id? an os user? a database schema owner? how many instances have you got? define unique database ids?
Similar Messages
-
How to pass a date parameter from report builder query designer to oracle database
i'm using report builder 3.0 connected to oracle database. i'm trying to pass a date parameter in the query with no success, i don't
know the exact syntax. I've tried :
SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEAR IN(:UW_YEAR) AND (LOSS_DATE) >To_Date('01/01/2014','mm/dd/yyyy')
it worked perfectly.
However if i try to put a date parameter "From" instead of 01/01/2014 it will not work, a Define Query Parameter popup window appear and error occurred after i fill
the values (usually i shouldnt get this popup i should enter the value when i run the report)
SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEAR IN(:UW_YEAR) AND (LOSS_DATE) >To_Date(:From,'mm/dd/yyyy')
appreciate your assistanceHi Gorgo,
According to your description, you have problem when in passing a parameter for running a Oracle Query. Right?
Based on my knowledge, it use "&" as synax for parameter in Oracle, like we use "@" in SQL Server. In this scenario, maybe you can try '01/01/2014' when inputing in "From". We are not sure if there's any limitation for To_Date()
function. For your self-testing, you can try the query in sqlplus/sql delveloper. Since your issue is related to Oracle query, we suggest you post this thread onto Oracle forum.
Best Regards,
Simon Hou -
How to generate XML file from oracle database query result
Hi dudes,
as stated on the subject, can anyone suggests me how can i achieve the task stated above??
Here is a brief description of my problem:
I need to create a XML file once i query from the oracle database, and the query result returned from the database will be stored in XML file.
I'd searched around the JAXB, DOM, SAXP and the like basic concepts, but i still don't know how to start??
Any suggestions ???Read this:
http://www.cafeconleche.org/books/xmljava/chapters/ch08s05.html
You might have to read more of the book to understand that chapter. -
Query in timesten taking more time than query in oracle database
Hi,
Can anyone please explain me why query in timesten taking more time
than query in oracle database.
I am mentioning in detail what are my settings and what have I done
step by step.........
1.This is the table I created in Oracle datababase
(Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)...
CREATE TABLE student (
id NUMBER(9) primary keY ,
first_name VARCHAR2(10),
last_name VARCHAR2(10)
2.THIS IS THE ANONYMOUS BLOCK I USE TO
POPULATE THE STUDENT TABLE(TOTAL 2599999 ROWS)...
declare
firstname varchar2(12);
lastname varchar2(12);
catt number(9);
begin
for cntr in 1..2599999 loop
firstname:=(cntr+8)||'f';
lastname:=(cntr+2)||'l';
if cntr like '%9999' then
dbms_output.put_line(cntr);
end if;
insert into student values(cntr,firstname, lastname);
end loop;
end;
3. MY DSN IS SET THE FOLLWING WAY..
DATA STORE PATH- G:\dipesh3repo\db
LOG DIRECTORY- G:\dipesh3repo\log
PERM DATA SIZE-1000
TEMP DATA SIZE-1000
MY TIMESTEN VERSION-
C:\Documents and Settings\dipesh>ttversion
TimesTen Release 7.0.3.0.0 (32 bit NT) (tt70_32:17000) 2007-09-19T16:04:16Z
Instance admin: dipesh
Instance home directory: G:\TimestTen\TT70_32
Daemon home directory: G:\TimestTen\TT70_32\srv\info
THEN I CONNECT TO THE TIMESTEN DATABASE
C:\Documents and Settings\dipesh> ttisql
command>connect "dsn=dipesh3;oraclepwd=tiger";
4. THEN I START THE AGENT
call ttCacheUidPwdSet('SCOTT','TIGER');
Command> CALL ttCacheStart();
5.THEN I CREATE THE READ ONLY CACHE GROUP AND LOAD IT
create readonly cache group rc_student autorefresh
interval 5 seconds from student
(id int not null primary key, first_name varchar2(10), last_name varchar2(10));
load cache group rc_student commit every 100 rows;
6.NOW I CAN ACCESS THE TABLES FROM TIMESTEN AND PERFORM THE QUERY
I SET THE TIMING..
command>TIMING 1;
consider this query now..
Command> select * from student where first_name='2155666f';
< 2155658, 2155666f, 2155660l >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.668822 seconds.
another query-
Command> SELECT * FROM STUDENTS WHERE FIRST_NAME='2340009f';
2206: Table SCOTT.STUDENTS not found
Execution time (SQLPrepare) = 0.074964 seconds.
The command failed.
Command> SELECT * FROM STUDENT where first_name='2093434f';
< 2093426, 2093434f, 2093428l >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.585897 seconds.
Command>
7.NOW I PERFORM THE SIMILAR QUERIES FROM SQLPLUS...
SQL> SELECT * FROM STUDENT WHERE FIRST_NAME='1498671f';
ID FIRST_NAME LAST_NAME
1498663 1498671f 1498665l
Elapsed: 00:00:00.15
Can anyone please explain me why query in timesten taking more time
that query in oracle database.
Message was edited by: Dipesh Majumdar
user542575
Message was edited by:
user542575TimesTen
Hardware: Windows Server 2003 R2 Enterprise x64; 8 x Dual-core AMD 8216 2.41GHz processors; 32 GB RAM
Version: 7.0.4.0.0 64 bit
Schema:
create usermanaged cache group factCache from
MV_US_DATAMART
ORDER_DATE DATE,
IF_SYSTEM VARCHAR2(32) NOT NULL,
GROUPING_ID TT_BIGINT,
TIME_DIM_ID TT_INTEGER NOT NULL,
BUSINESS_DIM_ID TT_INTEGER NOT NULL,
ACCOUNT_DIM_ID TT_INTEGER NOT NULL,
ORDERTYPE_DIM_ID TT_INTEGER NOT NULL,
INSTR_DIM_ID TT_INTEGER NOT NULL,
EXECUTION_DIM_ID TT_INTEGER NOT NULL,
EXEC_EXCHANGE_DIM_ID TT_INTEGER NOT NULL,
NO_ORDERS TT_BIGINT,
FILLED_QUANTITY TT_BIGINT,
CNT_FILLED_QUANTITY TT_BIGINT,
QUANTITY TT_BIGINT,
CNT_QUANTITY TT_BIGINT,
COMMISSION BINARY_FLOAT,
CNT_COMMISSION TT_BIGINT,
FILLS_NUMBER TT_BIGINT,
CNT_FILLS_NUMBER TT_BIGINT,
AGGRESSIVE_FILLS TT_BIGINT,
CNT_AGGRESSIVE_FILLS TT_BIGINT,
NOTIONAL BINARY_FLOAT,
CNT_NOTIONAL TT_BIGINT,
TOTAL_PRICE BINARY_FLOAT,
CNT_TOTAL_PRICE TT_BIGINT,
CANCELLED_ORDERS_COUNT TT_BIGINT,
CNT_CANCELLED_ORDERS_COUNT TT_BIGINT,
ROUTED_ORDERS_NO TT_BIGINT,
CNT_ROUTED_ORDERS_NO TT_BIGINT,
ROUTED_LIQUIDITY_QTY TT_BIGINT,
CNT_ROUTED_LIQUIDITY_QTY TT_BIGINT,
REMOVED_LIQUIDITY_QTY TT_BIGINT,
CNT_REMOVED_LIQUIDITY_QTY TT_BIGINT,
ADDED_LIQUIDITY_QTY TT_BIGINT,
CNT_ADDED_LIQUIDITY_QTY TT_BIGINT,
AGENT_CHARGES BINARY_FLOAT,
CNT_AGENT_CHARGES TT_BIGINT,
CLEARING_CHARGES BINARY_FLOAT,
CNT_CLEARING_CHARGES TT_BIGINT,
EXECUTION_CHARGES BINARY_FLOAT,
CNT_EXECUTION_CHARGES TT_BIGINT,
TRANSACTION_CHARGES BINARY_FLOAT,
CNT_TRANSACTION_CHARGES TT_BIGINT,
ORDER_MANAGEMENT BINARY_FLOAT,
CNT_ORDER_MANAGEMENT TT_BIGINT,
SETTLEMENT_CHARGES BINARY_FLOAT,
CNT_SETTLEMENT_CHARGES TT_BIGINT,
RECOVERED_AGENT BINARY_FLOAT,
CNT_RECOVERED_AGENT TT_BIGINT,
RECOVERED_CLEARING BINARY_FLOAT,
CNT_RECOVERED_CLEARING TT_BIGINT,
RECOVERED_EXECUTION BINARY_FLOAT,
CNT_RECOVERED_EXECUTION TT_BIGINT,
RECOVERED_TRANSACTION BINARY_FLOAT,
CNT_RECOVERED_TRANSACTION TT_BIGINT,
RECOVERED_ORD_MGT BINARY_FLOAT,
CNT_RECOVERED_ORD_MGT TT_BIGINT,
RECOVERED_SETTLEMENT BINARY_FLOAT,
CNT_RECOVERED_SETTLEMENT TT_BIGINT,
CLIENT_AGENT BINARY_FLOAT,
CNT_CLIENT_AGENT TT_BIGINT,
CLIENT_ORDER_MGT BINARY_FLOAT,
CNT_CLIENT_ORDER_MGT TT_BIGINT,
CLIENT_EXEC BINARY_FLOAT,
CNT_CLIENT_EXEC TT_BIGINT,
CLIENT_TRANS BINARY_FLOAT,
CNT_CLIENT_TRANS TT_BIGINT,
CLIENT_CLEARING BINARY_FLOAT,
CNT_CLIENT_CLEARING TT_BIGINT,
CLIENT_SETTLE BINARY_FLOAT,
CNT_CLIENT_SETTLE TT_BIGINT,
CHARGEABLE_TAXES BINARY_FLOAT,
CNT_CHARGEABLE_TAXES TT_BIGINT,
VENDOR_CHARGE BINARY_FLOAT,
CNT_VENDOR_CHARGE TT_BIGINT,
ROUTING_CHARGES BINARY_FLOAT,
CNT_ROUTING_CHARGES TT_BIGINT,
RECOVERED_ROUTING BINARY_FLOAT,
CNT_RECOVERED_ROUTING TT_BIGINT,
CLIENT_ROUTING BINARY_FLOAT,
CNT_CLIENT_ROUTING TT_BIGINT,
TICKET_CHARGES BINARY_FLOAT,
CNT_TICKET_CHARGES TT_BIGINT,
RECOVERED_TICKET_CHARGES BINARY_FLOAT,
CNT_RECOVERED_TICKET_CHARGES TT_BIGINT,
PRIMARY KEY(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID, INSTR_DIM_ID, EXECUTION_DIM_ID,EXEC_EXCHANGE_DIM_ID),
READONLY);
No of rows: 2228558
Config:
< CkptFrequency, 600 >
< CkptLogVolume, 0 >
< CkptRate, 0 >
< ConnectionCharacterSet, US7ASCII >
< ConnectionName, tt_us_dma >
< Connections, 64 >
< DataBaseCharacterSet, AL32UTF8 >
< DataStore, e:\andrew\datacache\usDMA >
< DurableCommits, 0 >
< GroupRestrict, <NULL> >
< LockLevel, 0 >
< LockWait, 10 >
< LogBuffSize, 65536 >
< LogDir, e:\andrew\datacache\ >
< LogFileSize, 64 >
< LogFlushMethod, 1 >
< LogPurge, 0 >
< Logging, 1 >
< MemoryLock, 0 >
< NLS_LENGTH_SEMANTICS, BYTE >
< NLS_NCHAR_CONV_EXCP, 0 >
< NLS_SORT, BINARY >
< OracleID, NYCATP1 >
< PassThrough, 0 >
< PermSize, 4000 >
< PermWarnThreshold, 90 >
< PrivateCommands, 0 >
< Preallocate, 0 >
< QueryThreshold, 0 >
< RACCallback, 0 >
< SQLQueryTimeout, 0 >
< TempSize, 514 >
< TempWarnThreshold, 90 >
< Temporary, 1 >
< TransparentLoad, 0 >
< TypeMode, 0 >
< UID, OS_OWNER >
ORACLE:
Hardware: Sunos 5.10; 24x1.8Ghz (unsure of type); 82 GB RAM
Version 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
Schema:
CREATE MATERIALIZED VIEW OS_OWNER.MV_US_DATAMART
TABLESPACE TS_OS
PARTITION BY RANGE (ORDER_DATE)
PARTITION MV_US_DATAMART_MINVAL VALUES LESS THAN (TO_DATE(' 2007-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D1 VALUES LESS THAN (TO_DATE(' 2007-11-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D2 VALUES LESS THAN (TO_DATE(' 2007-11-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D3 VALUES LESS THAN (TO_DATE(' 2007-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D1 VALUES LESS THAN (TO_DATE(' 2007-12-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D2 VALUES LESS THAN (TO_DATE(' 2007-12-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D3 VALUES LESS THAN (TO_DATE(' 2008-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D1 VALUES LESS THAN (TO_DATE(' 2008-01-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D2 VALUES LESS THAN (TO_DATE(' 2008-01-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D3 VALUES LESS THAN (TO_DATE(' 2008-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_MAXVAL VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE TS_OS
NOCACHE
NOCOMPRESS
NOPARALLEL
BUILD DEFERRED
USING INDEX
TABLESPACE TS_OS_INDEX
REFRESH FAST ON DEMAND
WITH PRIMARY KEY
ENABLE QUERY REWRITE
AS
SELECT order_date, if_system,
GROUPING_ID (order_date,
if_system,
business_dim_id,
time_dim_id,
account_dim_id,
ordertype_dim_id,
instr_dim_id,
execution_dim_id,
exec_exchange_dim_id
) GROUPING_ID,
/* ============ DIMENSIONS ============ */
time_dim_id, business_dim_id, account_dim_id, ordertype_dim_id,
instr_dim_id, execution_dim_id, exec_exchange_dim_id,
/* ============ MEASURES ============ */
-- o.FX_RATE /* FX_RATE */,
COUNT (*) no_orders,
-- SUM(NO_ORDERS) NO_ORDERS,
-- COUNT(NO_ORDERS) CNT_NO_ORDERS,
SUM (filled_quantity) filled_quantity,
COUNT (filled_quantity) cnt_filled_quantity, SUM (quantity) quantity,
COUNT (quantity) cnt_quantity, SUM (commission) commission,
COUNT (commission) cnt_commission, SUM (fills_number) fills_number,
COUNT (fills_number) cnt_fills_number,
SUM (aggressive_fills) aggressive_fills,
COUNT (aggressive_fills) cnt_aggressive_fills,
SUM (fx_rate * filled_quantity * average_price) notional,
COUNT (fx_rate * filled_quantity * average_price) cnt_notional,
SUM (fx_rate * fills_number * average_price) total_price,
COUNT (fx_rate * fills_number * average_price) cnt_total_price,
SUM (CASE
WHEN order_status = 'C'
THEN 1
ELSE 0
END) cancelled_orders_count,
COUNT (CASE
WHEN order_status = 'C'
THEN 1
ELSE 0
END
) cnt_cancelled_orders_count,
-- SUM(t.FX_RATE*t.NO_FILLS*t.AVG_PRICE) AVERAGE_PRICE,
-- SUM(FILLS_NUMBER*AVERAGE_PRICE) STAGING_AVERAGE_PRICE,
-- COUNT(FILLS_NUMBER*AVERAGE_PRICE) CNT_STAGING_AVERAGE_PRICE,
SUM (routed_orders_no) routed_orders_no,
COUNT (routed_orders_no) cnt_routed_orders_no,
SUM (routed_liquidity_qty) routed_liquidity_qty,
COUNT (routed_liquidity_qty) cnt_routed_liquidity_qty,
SUM (removed_liquidity_qty) removed_liquidity_qty,
COUNT (removed_liquidity_qty) cnt_removed_liquidity_qty,
SUM (added_liquidity_qty) added_liquidity_qty,
COUNT (added_liquidity_qty) cnt_added_liquidity_qty,
SUM (agent_charges) agent_charges,
COUNT (agent_charges) cnt_agent_charges,
SUM (clearing_charges) clearing_charges,
COUNT (clearing_charges) cnt_clearing_charges,
SUM (execution_charges) execution_charges,
COUNT (execution_charges) cnt_execution_charges,
SUM (transaction_charges) transaction_charges,
COUNT (transaction_charges) cnt_transaction_charges,
SUM (order_management) order_management,
COUNT (order_management) cnt_order_management,
SUM (settlement_charges) settlement_charges,
COUNT (settlement_charges) cnt_settlement_charges,
SUM (recovered_agent) recovered_agent,
COUNT (recovered_agent) cnt_recovered_agent,
SUM (recovered_clearing) recovered_clearing,
COUNT (recovered_clearing) cnt_recovered_clearing,
SUM (recovered_execution) recovered_execution,
COUNT (recovered_execution) cnt_recovered_execution,
SUM (recovered_transaction) recovered_transaction,
COUNT (recovered_transaction) cnt_recovered_transaction,
SUM (recovered_ord_mgt) recovered_ord_mgt,
COUNT (recovered_ord_mgt) cnt_recovered_ord_mgt,
SUM (recovered_settlement) recovered_settlement,
COUNT (recovered_settlement) cnt_recovered_settlement,
SUM (client_agent) client_agent,
COUNT (client_agent) cnt_client_agent,
SUM (client_order_mgt) client_order_mgt,
COUNT (client_order_mgt) cnt_client_order_mgt,
SUM (client_exec) client_exec, COUNT (client_exec) cnt_client_exec,
SUM (client_trans) client_trans,
COUNT (client_trans) cnt_client_trans,
SUM (client_clearing) client_clearing,
COUNT (client_clearing) cnt_client_clearing,
SUM (client_settle) client_settle,
COUNT (client_settle) cnt_client_settle,
SUM (chargeable_taxes) chargeable_taxes,
COUNT (chargeable_taxes) cnt_chargeable_taxes,
SUM (vendor_charge) vendor_charge,
COUNT (vendor_charge) cnt_vendor_charge,
SUM (routing_charges) routing_charges,
COUNT (routing_charges) cnt_routing_charges,
SUM (recovered_routing) recovered_routing,
COUNT (recovered_routing) cnt_recovered_routing,
SUM (client_routing) client_routing,
COUNT (client_routing) cnt_client_routing,
SUM (ticket_charges) ticket_charges,
COUNT (ticket_charges) cnt_ticket_charges,
SUM (recovered_ticket_charges) recovered_ticket_charges,
COUNT (recovered_ticket_charges) cnt_recovered_ticket_charges
FROM us_datamart_raw
GROUP BY order_date,
if_system,
business_dim_id,
time_dim_id,
account_dim_id,
ordertype_dim_id,
instr_dim_id,
execution_dim_id,
exec_exchange_dim_id;
-- Note: Index I_SNAP$_MV_US_DATAMART will be created automatically
-- by Oracle with the associated materialized view.
CREATE UNIQUE INDEX OS_OWNER.MV_US_DATAMART_UDX ON OS_OWNER.MV_US_DATAMART
(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID,
INSTR_DIM_ID, EXECUTION_DIM_ID, EXEC_EXCHANGE_DIM_ID)
NOLOGGING
NOPARALLEL
COMPRESS 7;
No of rows: 2228558
The query (taken Mondrian) I run against each of them is:
select sum("MV_US_DATAMART"."NOTIONAL") as "m0"
--, sum("MV_US_DATAMART"."FILLED_QUANTITY") as "m1"
--, sum("MV_US_DATAMART"."AGENT_CHARGES") as "m2"
--, sum("MV_US_DATAMART"."CLEARING_CHARGES") as "m3"
--, sum("MV_US_DATAMART"."EXECUTION_CHARGES") as "m4"
--, sum("MV_US_DATAMART"."TRANSACTION_CHARGES") as "m5"
--, sum("MV_US_DATAMART"."ROUTING_CHARGES") as "m6"
--, sum("MV_US_DATAMART"."ORDER_MANAGEMENT") as "m7"
--, sum("MV_US_DATAMART"."SETTLEMENT_CHARGES") as "m8"
--, sum("MV_US_DATAMART"."COMMISSION") as "m9"
--, sum("MV_US_DATAMART"."RECOVERED_AGENT") as "m10"
--, sum("MV_US_DATAMART"."RECOVERED_CLEARING") as "m11"
--,sum("MV_US_DATAMART"."RECOVERED_EXECUTION") as "m12"
--,sum("MV_US_DATAMART"."RECOVERED_TRANSACTION") as "m13"
--, sum("MV_US_DATAMART"."RECOVERED_ROUTING") as "m14"
--, sum("MV_US_DATAMART"."RECOVERED_ORD_MGT") as "m15"
--, sum("MV_US_DATAMART"."RECOVERED_SETTLEMENT") as "m16"
--, sum("MV_US_DATAMART"."RECOVERED_TICKET_CHARGES") as "m17"
--,sum("MV_US_DATAMART"."TICKET_CHARGES") as "m18"
--, sum("MV_US_DATAMART"."VENDOR_CHARGE") as "m19"
from "OS_OWNER"."MV_US_DATAMART" "MV_US_DATAMART"
where I uncomment a column at a time and rerun. I improved the TimesTen results since my first post, by retyping the NUMBER columns to BINARY_FLOAT. The results I got were:
No Columns ORACLE TimesTen
1 1.05 0.94
2 1.07 1.47
3 2.04 1.8
4 2.06 2.08
5 2.09 2.4
6 3.01 2.67
7 4.02 3.06
8 4.03 3.37
9 4.04 3.62
10 4.06 4.02
11 4.08 4.31
12 4.09 4.61
13 5.01 4.76
14 5.02 5.06
15 5.04 5.25
16 5.05 5.48
17 5.08 5.84
18 6 6.21
19 6.02 6.34
20 6.04 6.75 -
Store SQL Query in Oracle database
Hello,
I am storing SQL query in database. here is an example of query.
INSERT INTO TABLE_1 Values (' " + getValue1() + " ', ' " + getValue2() + " ' )
getValue1() and getValue2() are functions to retrieve values.
When I read query from the database and execute it, it doesn't read values from function.
After I read query from database I would expect it to be
INSERT INTO TABLE_1 Values ('value1', ' value2' ) but it is not reading values and trying to execute whatever I got from database.
Any help?
ThanksThanks for your reply. Let me give you more info.
All I am trying to do is storing queries in oracle
database to use it in future for reporting. As I am
doing reporting where clause will be different every
time. Reporting involves queries not updates. But in any case that means that you would use a java SQL string that is useable via a prepared statement. As such your statement would look like....
INSERT INTO TABLE_1 Values (?,?)
Is it not possible to substitute variable string I
got from database?What do you mean?
SQL is SQL. You construct SQL so it is valid and runs. Can you construct SQL so it runs a function/select and uses that value in some more SQL - depends on the database, but usually.
But that has nothing to do with java - it is SQL.
Query contains variables that I have in Java code .Then it is SQL. It is java. You use bind variables (see PreparedStatement) and assign values to it.
The SQL for such a query would look like the following...
select field1, field2 from table1 where id=?
In your java you would then use something like PreparedStatement.setInt(1, 100), to fill in the value for the '?' in the above.
You might also note that your solution will not work for any arbritrary SQL statement unless you are also storing meta data about the SQL itself. For instance the following SQL statements would return the same result set but your java code would have to populate the bind variables different for both...
select field1, field2 from table1 where id=? and name=?
select field1, field2 from table1 where name=? and id=? -
Querying an Oracle Database Using XSL
I know from years of experience as an Oracle DBA that to suggest that a program generate SQL is anathema, but I'm going to ask anyway!
Is there currently (or soon) to be a means of submitting XSL (or, perhaps, some variant based on the most recently published "standard") to an Oracle database and receiving an XML result set?
Note that I have not mentioned writing any SQL myself. I'm either looking for some middleware to translate the XSL "query" into the appropriate SQL query (with appropriate after-query transformations) or for the database engine itself to be able to parse and optimize XSL.
I just read a position paper (dated 1998) on this site that says that Oracle intends to closely follow developments in the world of XML Query. And, I've read in a "Byte" article ("Where Are The XML Apps We Can See And Touch? Report From XML DevCon 2001", April 2001, Jon Udell) that Steve Muench had demonstrated some means of super-imposing an XML schema over top of a database in order to query it via XPath. Where does the product stand in regards to this type of functionality?
Thanks in advance,
David Park
[email protected]For your reference:
1/XML SQL Utility(XSU) in XDK for Java (also with PL/SQL API)
http://technet.oracle.com/tech/xml/xdk_java
- The XSU can transform data retreived from object-relational database tables or views into XML.
- The XSU can extract data from a XML document and using a canonical mapping, insert the data into the appropriate columns/attributes of a table or a view.
- The XSU can extract data from a XML document and apply this data to updating or deleteing values of the appropriate columns/attributes.
2/ The documents for XMLType and DBUri(available in Oracle9i).
http://otn.oracle.com/docs/products/oracle9i/doc_library/901_doc/appdev.901/a88894/adx05xml.htm#1012692
3/ Oracle Text also have XPATH-based search.
http://otn.oracle.com/docs/products/oracle9i/doc_library/901_doc/text.901/a90122/csectio4.htm#33034 -
Problem querying an Oracle Database using PHP
Hi there, im rather new to Oracle so pardon my ignorance if this is completely obvious but I am creating a web form that queries an oracle database, firstly is a user form which looks like this.
<br><br>
Search for Investments<br>
<form action="query.php" method="POST"><br>
<input type = "text" name = "invest"><br>
<input type="submit" value="Search" name="submit" /><br>
</form><br>
-----------------------<br><br>
and the php script which looks like this<br><br>
-----------------------<br><br>
<?php<br><
print "<HTML><PRE>";<br><br>
require_once('connect.php');<br>
select_data($conn);<br><br>
$invest = $_POST['invest'];<br>
echo "Returning results related to $invest";<br><br>
function select_data($conn)<br>
{ $stmt = ociparse($conn,"select * from investmentbase where INVTYPE='$invest'");<br>
ociexecute($stmt,OCI_DEFAULT);<br><br>
echo "<table border = 1 class=results>";<br><br>
echo "<tr>";<br>
echo "<td>Reference Number</td>";<br>
echo "<td>User ID</td>";<br>
echo "<td>Investment Type</td>";<br>
echo "<td>Investment Description</td>";<br>
echo "<td>Amount Required</td>";<br>
echo "<td>Due Date<td>";<br>
echo "</tr>";<br><br>
while (ocifetch($stmt)){<br>
echo "<tr>";<br>
echo "<td>";<br>
echo ociresult($stmt,"INVREF")." ";<br>
echo "</td>";<br>
echo "<td>";<br>
echo ociresult($stmt,"USERID")." ";<br>
echo "</td>";<br>
echo "<td>";<br>
echo ociresult($stmt,"INVTYPE")." ";<br>
echo "</td>";<br>
echo "<td>";<br>
echo ociresult($stmt,"INVDESCRIPTION")." ";<br>
echo "</td>";<br>
echo "<td>";<br>
echo ociresult($stmt,"AMOUNTREQUIRED")." ";<br>
echo "</td>";<br>
echo "<td>";<br>
echo ociresult($stmt,"REQUIREDATE");<br>
echo "</td>";<br>
echo "</tr>";<br><br>
}<br>
echo "</table>";<br>
}<br><br>
ocilogoff($conn);<br>
print "</PRE></HTML>";<br>
?> <br><br>
When i search for a value that is in the database no results are returned, however the form is definitely posting the variable as the echo statement on the PHP script displays it. Any ideas would be gratefully appreciated
Many Thanks
PaulDo you need to set $invest before calling do_select() and pass it as a
parameter? Also, watch out for SQL Injection security risks. Try
using a bind variable.
$invest = $_POST['invest'];
echo "Returning results related to $invest";
select_data($conn, $invest);
function select_data($conn, $invest)
$stmt = ociparse($conn,"select * from investmentbase where INVTYPE=:ibv");
ocibindbyname($stmt, ':ibv', $invest);
ociexecute($stmt,OCI_DEFAULT);
. . .Although the PHP 4 naming style for oci8 functions can be used with
PHP 5, I know there is a possibility you are using the PHP 4 OCI8
extension. If you are, then upgrade at least OCI8. There are some
notes on this in
Re: frustrations with oci_fetch_array()
-- cj -
Oracle database parallel query
Hello,
I am trying to execute a pararallel query in oracle oracle database 10g but it is not working. please see the below server settings and explain plan.
NAME TYPE VALUE
fast_start_parallel_rollback string LOW
parallel_adaptive_multi_user boolean TRUE
parallel_automatic_tuning boolean TRUE
parallel_execution_message_size integer 4096
parallel_instance_group string
parallel_max_servers integer 40
parallel_min_percent integer 0
parallel_min_servers integer 0
parallel_server boolean TRUE
parallel_server_instances integer 2
parallel_threads_per_cpu integer 2
xplain plan of SELECT /*+ PARALLEL(a, 2) */ * FROM prt_sales_disc_matrix where sdm_crt_user='sys'
Plan
SELECT STATEMENT ALL_ROWS Cost: 89,113 Bytes: 144 Cardinality: 1
1 TABLE ACCESS FULL TABLE PRISM.PRT_SALES_DISC_MATRIX Cost: 89,113 Bytes: 144 Cardinality: 1Apart from the important syntactical error which sb has highlighted, the parallel hint does not mandate that the statement is run in parallel.
http://jonathanlewis.wordpress.com/2007/06/17/hints-again/ -
Query using link server to an Oracle database failswhile similar query works
I have two queries almost the same that use a link to an Oracle database. One works ok, the other is a copy of the first with a few fields selects removed. The first one works fine, the copy fails with: Cannot get the data of the row from the OLE DB
provider "OraOLEDB.Oracle" for linked server "linkname".
They are so similar, why would one work but not the other?
First query, this one works:
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE
PROCEDURE [dbo].[procedure_name]
-- Add the parameters for the stored procedure here
@Begindate Datetime,
@Enddate Datetime
AS
BEGIN
--SET NOCOUNT ON added to prevent extra result sets from
--interfering with SELECT statements.
SET NOCOUNT
ON;
-- Insert statements for procedure here
select p.patientid, p.testid,
mdx."Dx_4", td.acquisitiondatetime_dt, td.democompletedatetime_dt,
td.editdatetime_dt,
CAST(STUFF(STUFF(mn."Arrival_Time_9",
9, 0,
' '), 12, 0,
AS datetime)
as Arrival_date,
CAST(STUFF(STUFF(mt."Comp_D_T_22",
9, 0,
' '), 12, 0,
AS datetime)
as Order_date, td.confirmdatetime_dt
(CAST(DATEDIFF
(MINUTE,
CAST (STUFF
(STUFF
(MN."ARRIVAL_TIME_9", 9,0,
' '), 12, 0,
AS DATETIME), TD.DEMOCOMPLETEDATETIME_DT)
as char(10))
+ 'min')
AS "ARRIVAL TO COMPLETE",
(CAST(DATEDIFF
(MINUTE,
CAST (STUFF
(STUFF
(MT."COMP_D_T_22", 9,0,
' '), 12, 0,
AS DATETIME), TD.DEMOCOMPLETEDATETIME_DT)
as char(10))
+ 'min')
AS "ORDER TO COMPLETE"
from linknametosqldb.sqldbname.dbo.tstpatientdemographics
as p inner
join linknametosqldb.sqldbname dbo.tsttestdemographics
as td on p.testid
= td.testid
left
outer join linknametooracledb."M01Tab01_Main" mn
on td.visitnumber
= mn."Pt_Acct_5"
inner
JOIN linknametooracledb."M01Tab06_Ord" mt
ON mn."Master_Recid_1"
= mt."Master_Recid_1"
inner
join linknametooracledb."M01Tab09_Dx" mdx
on mn."Master_Recid_1"
= mdx."Master_Recid_1"
where td.location
in (2, 4)
and mt.order_4
like 'EKG%'
and mdx."Dx_4"
like '%Chest Pain%'
and
(td.acquisitiondatetime_dt
>= @Begindate and td.acquisitiondatetime_dt
< @Enddate)
order
by p.patientfullname_last, p.patientfullname_first
END
GO
Second query, copied from first with some fields selects removed, this does not work:
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE
PROCEDURE [dbo].[procedure_name_2]
-- Add the parameters for the stored procedure here
@Begindate Datetime,
@Enddate Datetime
AS
BEGIN
--SET NOCOUNT ON added to prevent extra result sets from
--interfering with SELECT statements.
SET NOCOUNT
ON;
-- Insert statements for procedure here
select p.patientid, mdx."Dx_4",
td.democompletedatetime_dt,
CAST(STUFF(STUFF(mn."Arrival_Time_9",
9, 0,
' '), 12, 0,
AS datetime)
as EDIS_Arrival_date,
(CAST(DATEDIFF
(MINUTE,
CAST (STUFF
(STUFF
(MN."Arrival_Time_9", 9,0,
' '), 12, 0,
AS DATETIME), TD.DEMOCOMPLETEDATETIME_DT)
as char(10))
+ 'min')
AS "ARRIVAL TO COMPLETE"
from linknametosqldb.dbo.tstpatientdemographics
as p inner
join linknametosqldb.dbo.tsttestdemographics
as td on p.testid
= td.testid
left outer
join linknametooracledb."M01Tab01_Main" mn
on td.visitnumber
= mn."Pt_Acct_5"
inner
JOIN linknametooracledb."M01Tab06_Ord" mt
ON mn."Master_Recid_1"
= mt."Master_Recid_1"
inner
join linknametooracledb M01Tab09_Dx" mdx
on mn."Master_Recid_1"
= mdx."Master_Recid_1"
where td.location
in (2, 4)
and mt.order_4
like 'EKG%'
and mdx."Dx_4"
like '%Chest Pain%'
and
(td.acquisitiondatetime_dt
>= @Begindate and td.acquisitiondatetime_dt
< @Enddate)
order
by p.patientid
END
GO
Thanks very much for any help with this.* Consider putting parentheses around the 3 oracle tables so the 3 of them can possibly be treated as a unit. Assuming there's some performance impact due to the linked server, this MIGHT help, may do a little joining over on the Oracle side of
the world. In either case, it's a little cleaner. They syntax below, including a few extra line breaks for clarity, should be correct. (try the change to the ON clause suggested above too, though).
The parentheses will not help much. SQL Server will remote (as the term is) the query to the Oracle instance if this appears to have a lower cost and there is nothing the blocks remoting.
On the other hand, OPENQUERY can be an alternative to ensure that this happens:
left outer join
OPENQUERY (linknametooracledb,
'SELECT ...
FROM "M01Tab01_Main" mn
JOIN "M01Tab06_Ord" mt ON mn."Master_Recid_1" = mt."Master_Recid_1"
JOIN "M01Tab09_Dx" mdx on mn."Master_Recid_1" = mdx."Master_Recid_1"') mn on td.visitnumber = mn."Pt_Acct_5"
But this presumes that you there are no columns from the SQL Server side that are used to select data from the Oracle side. That is, the above could lead to far much data being brought across the wire.
Then again, this does not really seem to relate to the original problem where a stored procedure was not working at all. That problem is not very easy to assist with since code post is the not the authentic code as pointed out in the thread. For instance
inner JOIN linknametooracledb."M01Tab06_Ord"
Has nothing to do with Oracle, but accesses a table in the schema linknametooracledb.
I think to help dmcm, you need a really good crystal ball - at least as long he/she does not share the actual code.
Erland Sommarskog, SQL Server MVP, [email protected] -
Query to insert file in Oracle database 9.2.0.1.0
how can I can reafear to a file field of an oracle database 9.2.0.1.0 in a query?
ThanksHi
Use external table definiton.
Ott Karesz
http://www.trendo-kft.hu -
I want to query oracle database from sql server can anyone tell steps 2 fo
i want to query oracle database from sql server can anyone tell steps 2 followed
i tried with linked servers but it is throwing errors can anyone hepl in this regard
The operation could not be performed because the OLE DB provider 'MSDAORA' was unable to begin a distributed transaction.
OLE DB error trace [OLE/DB Provider 'MSDAORA' ITransactionJoin::JoinTransaction returned 0x8004d01b].First of all - you are in the wrong forum.
Look either for the Database general or search for Transparant / Heterogenous Gateways.
cu
Andreas -
I want to query oracle database from sql server can anyone tell steps 2 fol
i want to query oracle database from sql server can anyone tell steps 2 followed
i tried with linked servers but it is throwing errors can anyone hepl in this regard
The operation could not be performed because the OLE DB provider 'MSDAORA' was unable to begin a distributed transaction.
OLE DB error trace [OLE/DB Provider 'MSDAORA' ITransactionJoin::JoinTransaction returned 0x8004d01b].First of all - you are in the wrong forum.
Look either for the Database general or search for Transparant / Heterogenous Gateways.
cu
Andreas -
How can i query oracle database data to xml file with c++?
I want query data to xml file directly in my c++ application .
I know the oracle XSU provide interferce for query data to xml
file directly.
But XSU for oracle8i does not support c++.
I do not know if XSU for oracle9i support c++.
can you tell me?
If i do not use XSU to finish my applicayion.
what interface that oracle provide can help me do my work?
thank you !BTW why do you want to migrate oracle database data to db2 database? Any specific project requirement like Parallel run with Oracle database (e.g data replication)? Or any other issues - Cost? Manageability? Availability? Business requirements?
Do you need to do a day-to-day data transfer or it is for permanent migration? -
Query Oracle database using JCheckBox getLabel()
Hey guys.
I'm not sure if this is the right place, so if it's not I greatly apologise! I just figured if it include Java code then it's appropriate.
Anyway, just a query...
I've got a Java application hooked up to an Oracle database. I was just wondering if it's possible to query a table in my database by using the getLabel() of JCheckBox?
E.g., SELECT * FROM Login WHERE Name LIKE '%box.getLabel()%'
I know getLabel() is deprecated now.
Now I look at it it seems more like an Oracle question than Java. :s
I was just wondering if this is possible at all? Don't want the code or any hints/help, just to see if it is do-able. :)
Thanks in advance!Thanks for your feedback. :) That's a relief, as I didn't want to be clutching at straws if something couldn't be done.
Thanks buddy. -
Executing the SQL query across 2 different databases of Oracle
Hello All,
In Microsoft SQL server we can execute following type of SQL query across 2 different databases:
select * from TEST1.dbo.GENERIC_TABLE1 union select * from TEST2.dbo.GENERIC_TABLE2;
Here TEST1 and TEST2 are 2 different databases.
Can we do the same in Oracle?yes you can, but first one has to setup a database link
Look up CREATE DATABASE LINK and then take things from there!
P;
Maybe you are looking for
-
Hi, I would be delighted if anyone could help with this , I am trying to reinstall my Photoshop Elements 6 onto my Macbook (Leopard 10.5.8) after a hard disc crash , I am using the original CD rom , but it just spits the CD back out once it gets so f
-
Hi, I have done some updates which work fine with Workshop, but when I try to deploy the application, I get : Errors found in E:\upload_RE7\PortalApplication\Portail\WEB-INF\src\com\xxxxxxx\xxxxxx\common\Constants.java: Error at line 3 column 8: Desc
-
Dear all, In FDM Classic I could use the fValueGet function to retrieve data from HFM. Is there a similar API existing in FDMEE if I want to create a mapping based on a pre-load data value in my HFM target application? Thanks a lot in advance, Christ
-
Hi All, We are trying to sett the partner profiles for source systems.Able to do RFC connection.But not able to see data. Thanks Sidd
-
Is there any way to instal 10.4.7 server into a June 2007 Macbook Pro 17?
I downloaded the 10.4.7 universal server release disk image and burned it onto a dvd, but my MBP 17 won't boot from it. It says it can be used by any intel computer but for some reason MBP doesn't boot. It's a Santa Rosa 2.4 Ghz MBP and I don't know