SQL in Input Tables
I have an input table in a mapping and I need to override the default select query with my own custom query having some filter criteria and some nvls and decode's and other such things.
Can anyone let me know where to write the source query override ??
-Arnab
Hi,
of course 2., but the OWB (look here: http://rapidshare.de/files/8032106/Filter_Mapping.pdf.html) generates following mapping:
-- Note: This generated code is for demonstration purposes only and may
-- not be deployable.
CREATE OR REPLACE PACKAGE "FILTER" AS
sql_stmt VARCHAR2(32767);
get_abort BOOLEAN := FALSE;
get_trigger_success BOOLEAN := TRUE;
get_errors NUMBER(22) := 0;
get_status NUMBER(22) := 0;
-- Status variable for Batch cursors
"ZUZ_KM1_St" BOOLEAN;
-- Function Main -- Entry point in package "FILTER"
FUNCTION Main RETURN NUMBER;
END "FILTER";
CREATE OR REPLACE PACKAGE BODY "FILTER" AS
-- Function "ZUZ_KM1_Bat"
-- performs batch extraction
-- Returns TRUE on success
-- Returns FALSE on failure
FUNCTION "ZUZ_KM1_Bat" RETURN BOOLEAN IS
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION ENABLE PARALLEL DML';
BEGIN
INSERT
/*+ APPEND PARALLEL(ZUZ_KM1, DEFAULT, DEFAULT) */
INTO
"ZUZ_KM1"
("AKV",
"FAMIS_AKV",
"MITGLIEDER_KVDR")
(SELECT
/*+ DRIVING_SITE("ZUZ_STA_15_C_ZUZ_STAGE2") */
"ZUZ_STA_15_C_ZUZ_STAGE2"."SPALTE_1" "SPALTE_1",
"ZUZ_STA_15_C_ZUZ_STAGE2"."SPALTE_2" "SPALTE_2",
"ZUZ_STA_15_C_ZUZ_STAGE2"."SPALTE_3" "SPALTE_3"
FROM {"ZUZ_STA_15"@C_ZUZ_STAGE2} "ZUZ_STA_15_C_ZUZ_STAGE2" WHERE ("ZUZ_STA_15_C_ZUZ_STAGE2"."SPALTE_1" <> '0')
COMMIT;
EXCEPTION WHEN OTHERS THEN
ROLLBACK;
COMMIT;
RETURN FALSE;
END;
COMMIT;
RETURN TRUE;
END "ZUZ_KM1_Bat";
FUNCTION Main RETURN NUMBER IS
get_batch_status BOOLEAN := TRUE;
BEGIN
-- Initialize all batch status variables
"ZUZ_KM1_St" := FALSE;
"ZUZ_KM1_St" := "ZUZ_KM1_Bat";
RETURN get_status;
END Main;
END "FILTER";
This is the same like 2.
Bye
Detlef
Similar Messages
-
How do I change the order of input tables in joiner?
I have 3 input tables in a JOINER, how can I change the order? for instance, the order now is: t1, t2, t3, for some reason, I want to change to t3, t2,t1.
I use outer join among tables, different table order cause OWB generated different sql statement.
Please help! Thanks.Unfortunately you cannot... The only way is to remove one group, then create a new one instead and re-connect the group...
JP -
When I run the code below I get the following error:"RUN-TIME ERROR '3078': The Microsoft Access database engine cannot find the input table or query 'False'. Make sure it exists and that its name is spelled correctly. Note that I do not call
anything by the name of "false" anywhere in this code.
The subject code (the underscored line of code is highlighted in the debugger when the error occurs):
Option Compare Database
Private Sub JobAssign_Click()
MatLotListAvail_openform
End Sub
Function MatLotListAvail_openform()
Dim dbsAPIShopManager2010 As DAO.Database
Dim rstMaterialLotJobJoint As DAO.Recordset
Dim strSQL As String
Set dbsAPIShopManager2010 = CurrentDb
strSQL = "SELECT * FROM MaterialLotJobJoint WHERE JobID" = "tempvars!JobID" And "MatLotID" = "tempvars!MatLotID"
Set rstMaterialLotJobJoint = dbsAPIShopManager2010.OpenRecordset(strSQL, dbOpenDynaset)
If rstMaterialLotJobJoint.EOF Then
DoCmd.OpenForm "JobAssignMatConf", acNormal, "", "", acEdit, acNormal
Forms!JobAssignMatConf!PartapiIDVH = TempVars!PartapiID
Forms!JobAssignMatConf!JobapiIDVH = TempVars!JobapiID
Forms!JobAssignMatConf!JobIDVH = TempVars!JobID
Forms!JobAssignMatConf!MaterialLotIDVH = TempVars!MatLotID
Forms!JobAssignMatConf!Desc = TempVars!MatDesc
Forms!JobAssignMatConf!recdate = TempVars!recdate
DoCmd.Close acForm, "MaterialLotListAvailable"
Else: MsgBox "This material lot has already been assigned to this job."
DoCmd.Close acForm, "MaterialLotListAvailable"
End If
End FunctionI think the SQL statement should be
strSQL = "SELECT * FROM MaterialLotJobJoint WHERE JobID=" & _
tempvars!JobID & " AND MatLotID=" & tempvars!MatLotID
This assumes thatJobID and MatLotID are number fields.
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
How to pass the data from a input table to RFC data service?
Hi,
I am doing a prototype with VC, I'm wondering how VC pass the data from a table view to a backend data service? For example, I have one RFC in the backend system with a tabel type importing parameter, now I want to pass all the data from an input table view to the RFC, I guess it's possible but I don't know how to do it.
I try to create some events between the input table and data service, but seems there is no a system event can export the whole table to the backend data service.
Thanks for your answer.Thanks for your answer, I tried the solution 2, I create "Submit" button, and ser the mapping scope to be "All data rows", it only works when I select at least one row, otherwise the data would not be passed.
Another question is I have serveral imported table parameter, for each table I have one "submit" event, I want these tables to be submitted at the same time, but if I click the submit button in one table toolbar, I can only submit the table data which has a submit button clicked, for other tables, the data is not passed, how can I achieve it?
Thanks. -
Startrfc - how to call with "input table"?
I have not been able to get sapnwrfc for Perl to compile correctly on my AIX systems so i want to try something different.
I started to investigate using startrfc to get my data but am running in to a problem.
Problem Summary: I want to get information via RFC_READ_TABLE using startrfc. I can successfully call function modules but cannot figure out how to send in a "WHERE" clause using startrfc. Does anyone know how to send "input tables" to startrfc so that I can limit my results?
Background: I want to dump a list of the dialog UIDs in a SID/client. When I do RFC_READ_TABLE via SE37, it asks for an "OPTIONS" input table that you use to put the "WHERE" clause. I fill in the information in the "TEXT" field and all is well.
I can call startrfc with the -T option and capture the output to a file, but I cannot figure out how to use an input file to provide the OPTIONS table. -E doesn't work.
Here is what I call:
/usr/sap/<SID>/DVEBMGS60/exe/startrfc -t -3 -h <hostname> -s 60 -c 000 -l E -u <my id> -p <my password> -F RFC_READ_TABLE -E QUERY_TABLE=USR02 -E "DELIMITER=|" -T DATA,1000,w=output.txt -T OPTIONS,100,r=input.txt
My input file (input.txt) looks like:
TEXT="BNAME = 'someuid'"
Here is the error message I get when I run this.
RFC Call/Exception: SYSTEM_FAILURE
Group Error group 104
Key RFC_ERROR_SYSTEM_FAILURE
Message A dynamically specified column name is unknown.
Note that I know that there are other functions to check for existence. I am attempting to get a dump of all dialog users with some information from USR02 not normally provided by the builtin function modules (ERDAT). This is just the first step to getting there. Once I have this figured out, I'll send in a "*" to match all. Also, I am able to do this sort of successfully via Perl's sapnwrfc but am unable to get it compile on AIX and that is where I need to run this.
Can anyone help?
Edited by: Eric Young on Apr 7, 2011 5:59 PM
Edited by: Eric Young on Apr 7, 2011 6:00 PMIt's fairly obtuse as well, but I can see that I'm sending something. I just don't know what it should look like so that SAP likes it. Here's the relevant send section:
000240 | 04000000 01033003 02000800 0001F400 |......0.......ô.|
000250 | 00000003 02030100 074F5054 494F4E53 |.........OPTIONS|
000260 | 03010330 00040000 00020330 03020008 |...0.......0....|
000270 | 00000032 00000001 03020303 00325445 |...2.........2TE|
000280 | 5854203D 2022424E 414D4520 20202020 |XT = "BNAME = 'S|
000290 | 20202020 20202020 20202020 20202020 |SOMEUID'" |
0002a0 | 20202020 20202020 20202020 20202020 | |
Please note that I've obfuscated "SOMEUID" and the corresponding HEX dump.
Edited by: Eric Young on Apr 7, 2011 6:26 PM -
Com.sap.sql.log.OpenSQLException: table or view not exists
Hi!.
I'm developing a Portal Component over NW EP 2004s (7.0) which access to SQL Server database. I have created three tables on the system db (EPD). Connection is Ok, over datasource object, but i can't make a SELECT operation to my new tables.
Hovewer, making a SELECT operation over older system tables is OK.
I have adjusted permissions on my new tables, similar to the older tables. The table's owner is the same too.
The exception i get is:
**Exception of type com.sap.sql.log.OpenSQLException caught: The SQL statement "SELECT * FROM "SAPEPDDB"."UME_EP_UNLOCKUSERS"" contains the semantics error[s]: - 1:24 - the table or view >>UME_EP_UNLOCKUSERS<< does not exist**
[EXCEPTION]
*com.sap.sql.log.OpenSQLException: The SQL statement "SELECT * FROM "SAPEPDDB"."UME_EP_UNLOCKUSERS"" contains the semantics error[s]: - 1:24 - the table or view >>UME_EP_UNLOCKUSERS<< does not exist*
at com.sap.sql.jdbc.common.StatementAnalyzerImpl.check(StatementAnalyzerImpl.java:38)
at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:101)
at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:87)
at com.sap.sql.jdbc.common.CommonStatementImpl.executeQuery(CommonStatementImpl.java:114)
at com.sap.engine.services.dbpool.wrappers.StatementWrapper.executeQuery(StatementWrapper.java:172)
at com.uralita.database.DbManager.executeQuery(DbManager.java:105)
at com.uralita.ListaSistemas$ListaSistemasDynPage.getSystemsR3(ListaSistemas.java:184)
at com.uralita.ListaSistemas$ListaSistemasDynPage.doInitialization(ListaSistemas.java:93)
at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:105)
at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.async.AsyncIncludeRunnable$1$DoDispatchRequest.run(AsyncIncludeRunnable.java:377)
at java.security.AccessController.doPrivileged(Native Method)
at com.sapportals.portal.prt.core.async.AsyncIncludeRunnable.run(AsyncIncludeRunnable.java:390)
at com.sapportals.portal.prt.core.async.ThreadContextRunnable.run(ThreadContextRunnable.java:164)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:729)
at java.lang.Thread.run(Thread.java:534)
Caused by: com.sap.sql.sqlparser.CommonSQLParserException: - 1:24 - the table or view >>UME_EP_UNLOCKUSERS<< does not exist
at com.sap.sql.sqlparser.CommonSQLStatement.checkSemantics(CommonSQLStatement.java:171)
at com.sap.sql.jdbc.common.StatementAnalyzerImpl.check(StatementAnalyzerImpl.java:35)
... 19 more
caused by
com.sap.sql.sqlparser.CommonSQLParserException: - 1:24 - the table or view >>UME_EP_UNLOCKUSERS<< does not exist
at com.sap.sql.sqlparser.CommonSQLStatement.checkSemantics(CommonSQLStatement.java:171)
at com.sap.sql.jdbc.common.StatementAnalyzerImpl.check(StatementAnalyzerImpl.java:35)
at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:101)
at com.sap.sql.jdbc.common.StatementAnalyzerImpl.preprepareStatement(StatementAnalyzerImpl.java:87)
at com.sap.sql.jdbc.common.CommonStatementImpl.executeQuery(CommonStatementImpl.java:114)
at com.sap.engine.services.dbpool.wrappers.StatementWrapper.executeQuery(StatementWrapper.java:172)
at com.uralita.database.DbManager.executeQuery(DbManager.java:105)
at com.uralita.ListaSistemas$ListaSistemasDynPage.getSystemsR3(ListaSistemas.java:184)
at com.uralita.ListaSistemas$ListaSistemasDynPage.doInitialization(ListaSistemas.java:93)
at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:105)
at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.async.AsyncIncludeRunnable$1$DoDispatchRequest.run(AsyncIncludeRunnable.java:377)
at java.security.AccessController.doPrivileged(Native Method)
at com.sapportals.portal.prt.core.async.AsyncIncludeRunnable.run(AsyncIncludeRunnable.java:390)
at com.sapportals.portal.prt.core.async.ThreadContextRunnable.run(ThreadContextRunnable.java:164)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:729)
at java.lang.Thread.run(Thread.java:534)
Someone has been getting this problem? Any idea?
Thanks!I have tried that.
[EXCEPTION]
*com.sap.sql.log.OpenSQLException: The SQL statement "SELECT * FROM EPD.SAPEPDDB.UME_EP_SLD" contains the syntax error[s]: - Open SQL syntax error: table names must not specify a catalog name (delete "EPD". before "SAPEPDDB"."UME_EP_SLD")*
Database name must be Ok, because i can access to other tables which are in the same DB...
Thanks for your help -
PL/SQL: ORA-00942: table or view does not exist
Hi
i have logged into my schema and trying to access the database "DAD" which has the table name "SCHOOL"
i wrote a function which should give me new_sno when i give it the old_sno
and i have this errors , pls help
CREATE OR REPLACE FUNCTION ORIG_SN(OSNO in Number,OTN in Number)
RETURN Number IS
NEW_SNO Number:=0;
BEGIN
SELECT new_sno AS NEW_SNO
FROM DAD.SCHOOL
WHERE ORIG_SNO = OSNO AND ORIG_TN = OTN;
RETURN NEW_SNO;
END ORIG_SN;
Warning: Function created with compilation errors.
Errors for FUNCTION ORIG_SN:
LINE/COL ERROR
5/1 PL/SQL: SQL Statement ignored
6/15 PL/SQL: ORA-00942: table or view does not exist
Thanks in advance ..Try this,
CREATE VIEW SCHOOL_VIEW AS SELECT * FROM DAD.SCHOOL;and then change your function like
CREATE OR REPLACE FUNCTION ORIG_SN(OSNO in Number,OTN in Number)
RETURN Number IS
my_new_sno Number:=0;
BEGIN
SELECT new_sno INTO my_new_sno FROM SCHOOL_VIEW WHERE ORIG_SNO = OSNO AND ORIG_TN = OTN;
RETURN my_new_sno;
END ORIG_SN;and see if it is getting created without any errors.
-Arun
Edited by: Arunkumar Ramamoorthy on Aug 15, 2009 1:56 AM -
How to delete a row from a SQL Server CE Table with multiple JOINs?
I want to delete a record from a SQL Server CE table.
There are 3 tables scripts, options and results. I would like to remove a record from the results table. The where clause contains dynamic information which retrieved via other queries to different tables in the same database. These queries work fine and deliver
the desired data.
The Compact server is a clone of a remote table created using the sync framework. The same query to the remote table works fine.
The error I get is:
There was an error parsing the query. [ Token line number = 1,Token line offset = 10,Token in error = from ]
The code that throws the exception is as follows:
Dim connLoc As SqlCeConnection = New SqlCeConnection(My.Settings.ConnectionString)connLoc.Open() Dim strDel As String = "Delete r from ResultsTable r inner join OptionsTable o ON o.TestName=r.TestName inner join ScriptTable c ON r.TestName=c.TestName WHERE r.TestName = '" & ds1Loc.Tables(0).Rows(0)(1) & "' AND [Index] = '" & lstIndex & "'"Dim cmdDel As SqlCeCommand = New SqlCeCommandcmdDel.CommandText = strDelcmdDel.Connection = connLoccmdDel.ExecuteNonQuery()
The values held in ds1Loc.Tables(0).Rows(0)(1) and lstIndex are
correct so should not be the problem.
I also tried using parameterised queries
Dim strDel As String = "Delete r from [ResultsTable] r inner join [OptionsTable] o ON o.TestName=r.TestName inner join [ScriptTable] c ON r.TestName=c.TestName WHERE r.TestName = @TestName AND [Index] = @lstIndex"
Dim cmdDel As SqlCeCommand = New SqlCeCommand cmdDel.CommandText = strDel
With cmdDel.Parameters
.Add(New SqlCeParameter("@TestName", ds1Loc.Tables(0).Rows(0)(1)))
.Add(New SqlCeParameter("@lstIndex", lstIndex))
End With
cmdDel.Connection = connLoc cmdDel.ExecuteNonQuery()
I have tried replacing the "=" with "IN" in the the WHERE clause but this has not worked.
Is it the join that is causing the problem? I can do a select with the same search criteria and joins from the same database.
Also this query works with SQL Server. Is it perhaps that SQL CE does not support the Delete function the same as SQL Server 2008? I have been looking at this for a while now and cannot find the source of the error. Any help would be greatly appreciated.Hello,
In SQL Server Compact, we can use join in FROM clause. The DELETE statement fail may be caused by the FOREIGN KEY constraint.
Please refer to:
DELETE (SQL Server Compact)
FROM Clause (SQL Server Compact)
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
How to implement two dependent dropdown lists in an input table row?
Hi all,
I am new in Jdev 11g. I try to develop an input table with two dependent dropdown list. I can create independent dropdown list in such table. When I try to implement dependent one following some examples do it in a form using bind variable in the view object I get an empty listbox. How can I do this? Is it possible. I cannot find any documents about this.
Thanks in advanceHi,
it hasn't changed between 10.1.3 and 11. The basic outline of how you do it is
- use a managed bean to query the data
- populate the list with f:selectItems that point to the managed bean ArrayList<SelectItem> for the master and the detail
- obtain the master ID in the managed bean by parsing the #{row} variable when the table renders
- then bulild the detail list
- have the detail list referencing the ArrayList<SelectItem> you expose for the details
Note that without proper caching, the action is quite expensive
Frank -
Error(20,22): PL/SQL: ORA-00942: table or view does not exist
I am getting currently getting an error when I try and insert into a table from a different schema from my Stored Procedure:
Error(20,22): PL/SQL: ORA-00942: table or view does not exist
I am explicitly calling the table with the schema name infront i.e.
INSERT INTO SAPSR3.ZTREC_NAME_TYPE
MASTER_ID,
NAME_TYPE,
FAMILY_NAME,
FIRST_NAME,
MIDDLE_NAME,
TITLE
VALUES
In_MasterID,
In_NameType,
In_FamilyName,
In_FirstName,
In_MiddleName,
In_Title
I only get this error when I try and compile my stored procedure. If I try this insert not within a stored procedure (i.e. a blank script) it works perfectly.
Can anyone tell me what Im doing wrong?
Thanks.Hi,
It sounds like you (the procedure owner) have privileges on that table only through a role.
Roles don't count in stored procedures created with AUTHID OWNER (which is the default).
Either
(1) Have user SAPSR3 grant the necessary privileges directly to you (or to PUBLIC), or
(2) change the procedure so that it runs with the caller's privileges, by adding AUTHID CURRENT_USER after the argument list but before the keyword IS (os AS) like this:
CREATE OR REPLACE PROCEDURE foo
( x IN NUMBER
AUTHID CURRENT_USER
IS ... -
ORA-31603:While Extracting SQL of a table I am getting this error.
Hi,
I am getting below error whenever I try to get the SQL for any table. I tried executing DBMS_METADATA() also but the same error is coming.
Please let me know what needs to be done IF I want to extract the DDL for any object.
ORA-31603: object "EMP" of type TABLE not found in schema "MKT"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 3241
ORA-06512: at "SYS.DBMS_METADATA", line 4812
ORA-06512: at line 1
Thanks,
Rusty....Hi,
use AUTHID CURRENT_USER show as below exmaple...
CREATE OR REPLACE FUNCTION xx_get_ddl(
p_object_type IN VARCHAR2
, p_object_name IN VARCHAR2
, p_owner IN VARCHAR2
RETURN CLOB AUTHID CURRENT_USER
IS
v_string CLOB;
BEGIN
SELECT DBMS_METADATA.get_ddl(p_object_type
, p_object_name
, p_owner
INTO v_string
FROM DUAL;
RETURN v_string;
EXCEPTION
WHEN OTHERS
THEN
RETURN NULL;
END; -
INSERTING DATA INTO A SQL SERVER 2005 TABLE, WHICH HAS A IDENTITY COLUMN
Hi All,
I have to insert the data into a SQL SERVER 2005 Database table.
I am able to insert the data into a normal SQL Server table.
When I am trying to insert the data into a SQL Server table, which has a identity column (i.e. auto increment column in Oracle) I am getting error saying that can't insert value explicitly when IDENTITY_INSERT is set to OFF.
Had anybody tried this??
There are some SRs on this issue, Oracle agreed that it is a bug. I am wondering if there is any workaround from any one of you (refer Insert in MS-SQL database table with IDENTITY COLUMN
Thanks
V KumarEven I had raised a SR on this in October 2008. But didn't get any solution for a long time, finally I had removed the identity column from the table. I can't to that now :).
I am using 10.1.3.3.0 and MS SQL SERVER 2005, They said it is working for MS SQL SERVER TABLE, if the identity column is not a primary key and asked me to refer to note 744735.1.
I had followed that note, but still it is not working for me.
But my requirement is it should work for a MS SQL SERVER 2005 table, which has identity column as primary key.
Thanks
V Kumar -
Input table sort for uncommited data
Hi OTN,
I have an input table on my ADF page. The table is based on a view object which has ORDER BY VALUE clause.
There is an opportunity to insert new rows and edit Value attribute of any row.
I would like the table always to be sorted by Value attribute before commiting the changes.
Input fields have autosubmit=true and I also have button which performs ADFUtils.findIterator(..).executeQuery() and refreshing the table (with addPartialTarget or table's partial trigger).
Besides I tried declarative column sorting.
By no means I succeeded to sort the table with new values without commiting data.
Is there any possibility to do this?
Thanks.
JDev 11.1.1.4Hi,
After applying this code in a managed bean System.out.println("ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES | ViewObject.QUERY_MODE_SCAN_VIEW_ROWS");
trIter.getViewObject().setQueryMode(ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES | ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
trIter.getViewObject().setSortBy("NEnd");
trIter.executeQuery();in-memory sorting really works.
But now I have a row with null NEnd first in my table. Without modifying query mode it was last just as I need.
It is now:null
10
20
30Can I bring null row back to last position?
Tried trIter.getViewObject().setSortBy("NEnd nulls last"); and trIter.getViewObject().setSortBy("deocde(NEnd, null, 9999, NEnd)"); with no success.
Edited by: ILya Cyclone on Jul 8, 2011 3:28 PM -
Slow SQL output when table alias is NOT used in order by clause
Hi guys,
My query is based on Oracle 9208
I have a table TAB1 with 68000 records with transaction_id as the primary key in this table (unique index).
I have another TAB2 with the same number of records again with transaction_id in this table (foreign key to above).
I have the below query that gets executed via an application:-
SELECT TO_CHAR(V1.TRANSACTION_ID), V1.POLICY_ID, V1.REQUEST_TYPE
FROM <VIEW> V1 WHERE V1.CERT_SERIAL_NUM=56192 AND
(V1.AUTH_GROUP_ID=0 OR V1.AUTH_GROUP_ID=1) AND ROWNUM <= 3 ORDER
BY TRANSACTION_ID ASC
The above view V1 is created as below:-
CREATE OR REPLACE FORCE VIEW "V1"
("TRANSACTION_ID",
"PARENT_TRANSACTION_ID",
"CA_DN_ID",
"AUTH_GROUP_ID",
"POLICY_ID",
"REQUEST_TYPE",
"REQUEST_STATUS",
"EE_DN_HASH",
"EE_DN",
"EE_EMAIL_HASH",
"EE_EMAIL",
"KEY_USAGE",
"SMART_CARD_SERIAL",
"CERT_TYPE",
"CERT_SERIAL_NUM",
"CERT_INDEX",
"RENEWAL_FLAG",
"ARCHIVE_FLAG",
"TIME_RECEIVED",
"DOWNLOADED",
"REQUEST_DATA",
"ACTION",
"STEP_NUM")
AS
SELECT
T1.transaction_id,
T1.parent_transaction_id,
T1.ca_dn_id,
V2.auth_group_id,
V2.policy_id,
T1.request_type,
T1.request_status,
T2.ee_dn_hash,
T2.ee_dn,
T2.ee_email_hash,
T2.ee_email,
T2.key_usage,
T2.smart_card_serial,
T2.cert_type,
T2.cert_serial_num,
T2.cert_index,
T2.renewal_flag,
T2.archive_flag,
T1.time_received,
T1.downloaded,
T1.request_data,
V2.action,
V2.step_num
FROM TAB1
<ANOTHER VIEW> V2,
TAB2 T1,
TAB2 T2
WHERE
T1.transaction_id = T2.transaction_id
AND
V2.policy_id = T1.policy_id
order by transaction_id;
The query at the top runs within milliseconds if the VIEW is created as :-
order by t2.transaction_id
But without the alias "t2" in the order by, the query takes about 1 1/2 minutes
Can you tell me why? I thought if you ordering by primary key (lesser number of values compared to foreign key values), the query should be faster..no?
Thanks in advanceThanks for keeping up with this issue Hemant.
Here are the plans for each case.
I would be very interested in how you'd recognize which plan is the best and what are the derivatives.
I don't much (or rather anything!) what is 'card' values, 'cost' values etc which I believe are used to decide the best plan of the lot.
Thanks again
Note TAB1 and TAB2 are from view definition posted initially
1) Execution Plan for VIEW1 <<-- With ORDER BY" clause but no table ailas (order by transaction_id)
SQL> EXPLAIN PLAN FOR SELECT TO_CHAR(QT.TRANSACTION_ID), QT.POLICY_ID, QT.REQUEST_TYPE
2 FROM <VIEW1> QT WHERE QT.CERT_SERIAL_NUM=24293 AND
3 (QT.AUTH_GROUP_ID=0 OR QT.AUTH_GROUP_ID=1) AND ROWNUM <= 3 ORDER
4 BY TRANSACTION_ID ASC
5 /
Explained.
Elapsed: 00:00:01.00
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 3 | 195 | 17 |
|* 1 | COUNT STOPKEY | | | | |
| 2 | VIEW | VIEW1 | 17 | 1105 | 17 |
|* 3 | SORT ORDER BY STOPKEY | | 17 | 38573 | 17 |
| 4 | NESTED LOOPS | | 17 | 38573 | 10 |
| 5 | MERGE JOIN CARTESIAN | | 1 | 167 | 9 |
| 6 | VIEW | VIEW2 | 1 | 52 | 8 |
| 7 | SORT UNIQUE | | 1 | 156 | 8 |
| 8 | NESTED LOOPS | | 1 | 156 | 6 |
| 9 | NESTED LOOPS | | 1 | 143 | 6 |
| 10 | NESTED LOOPS OUTER | | 1 | 117 | 5 |
|* 11 | HASH JOIN | | 1 | 104 | 5 |
| 12 | NESTED LOOPS | | 1 | 52 | 2 |
|* 13 | TABLE ACCESS FULL | TAB3 | 1 | 39 | 2 |
|* 14 | INDEX UNIQUE SCAN | (PK_TAB4) | 1 | 13 | |
| 15 | TABLE ACCESS FULL | TAB5 | 82 | 4264 | 2 |
| 16 | VIEW PUSHED PREDICATE | View3 | 1 | 13 | |
| 17 | NESTED LOOPS | | 1 | 52 | 2 |
| 18 | NESTED LOOPS | | 1 | 39 | 2 |
|* 19 | INDEX UNIQUE SCAN | (PK_TAB6) | 1 | 13 | 1 |
|* 20 | INDEX RANGE SCAN | (PK_TAB7) | 1 | 26 | 1 |
|* 21 | INDEX UNIQUE SCAN | (PK_TAB8) | 1 | 13 | |
| 22 | TABLE ACCESS BY INDEX ROWID| TAB9 | 3 | 78 | 1 |
|* 23 | INDEX UNIQUE SCAN | (PK_TAB9) | 1 | | |
|* 24 | INDEX UNIQUE SCAN | (PK_TAB10)| 1 | 13 | |
| 25 | BUFFER SORT | | 1 | 115 | 9 |
| 26 | TABLE ACCESS BY INDEX ROWID | TAB2 | 1 | 115 | 1 |
|* 27 | INDEX RANGE SCAN | (TAB2_IDX2)| 1 | | |
|* 28 | TABLE ACCESS BY INDEX ROWID | TAB1 | 12 | 25224 | 1 |
|* 29 | INDEX UNIQUE SCAN | (PK_TAB1) | 1 | | |
Predicate Information (identified by operation id):
1 - filter(ROWNUM<=3)
3 - filter(ROWNUM<=3)
11 - access("TAB5"."PATH_ID"="TAB4"."PATH_ID")
13 - filter("TAB3"."AUTH_GROUP_ID"<>(-1) AND ("TAB3"."AUTH_GROUP_ID"=0 OR "TAB3"."AUTH_GROUP_ID"=1))
14 - access("TAB3"."PATH_ID"="TAB4"."PATH_ID")
19 - access("TAB5"."DOMAIN_ID"="TAB6"."DOMAIN_ID")
20 - access("TAB6"."DOMAIN_ID"="TAB7"."DOMAIN_ID")
21 - access("TAB7"."RULE_ID"="TAB8"."RULE_ID")
23 - access("TAB9"."POLICY_ID"="TAB5"."POLICY_ID")
24 - access("TAB9"."ASSOCIATED_FORM_ID"="TAB10"."FORM_ID")
27 - access("TAB2"."CERT_SERIAL_NUM"=24293)
28 - filter("View2"."POLICY_ID"="TAB1"."POLICY_ID")
29 - access("TAB1"."TRANSACTION_ID"="TAB2"."TRANSACTION_ID")
Note: cpu costing is off
54 rows selected.
Elapsed: 00:00:01.81
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 COLLECTION ITERATOR (PICKLER FETCH) OF 'DISPLAY'
Statistics
39 recursive calls
0 db block gets
629 consistent gets
0 physical reads
104 redo size
5169 bytes sent via SQL*Net to client
405 bytes received via SQL*Net from client
5 SQL*Net roundtrips to/from client
31 sorts (memory)
0 sorts (disk)
54 rows processed
2) Execution Plan for VIEW1 <<-- With ORDER BY" clause and table alias (order by TAB2.transaction_id)
SQL> explain plan for SELECT TO_CHAR(QT.TRANSACTION_ID), QT.POLICY_ID, QT.REQUEST_TYPE
2 FROM <VIEW1> QT WHERE QT.CERT_SERIAL_NUM=30003 AND
3 (QT.AUTH_GROUP_ID=0 OR QT.AUTH_GROUP_ID=1) AND ROWNUM <= 3 ORDER
4 BY TRANSACTION_ID ASC
5 /
Explained.
Elapsed: 00:00:10.20
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 3 | 195 | 14 |
| 1 | SORT ORDER BY | | 3 | 195 | 14 |
|* 2 | COUNT STOPKEY | | | | |
| 3 | VIEW | VIEW1 | 17 | 1105 | 13 |
| 4 | NESTED LOOPS | | 17 | 38573 | 13 |
| 5 | MERGE JOIN CARTESIAN | | 1 | 167 | 12 |
|* 6 | TABLE ACCESS BY INDEX ROWID | TAB2 | 1 | 115 | 4 |
| 7 | INDEX FULL SCAN | (TAB2_IDX) | 94 | | 1 |
| 8 | BUFFER SORT | | 1 | 52 | 8 |
| 9 | VIEW | VIEW2 | 1 | 52 | 8 |
| 10 | SORT UNIQUE | | 1 | 156 | 8 |
| 11 | NESTED LOOPS | | 1 | 156 | 6 |
| 12 | NESTED LOOPS | | 1 | 143 | 6 |
| 13 | NESTED LOOPS OUTER | | 1 | 117 | 5 |
|* 14 | HASH JOIN | | 1 | 104 | 5 |
| 15 | NESTED LOOPS | | 1 | 52 | 2 |
|* 16 | TABLE ACCESS FULL | TAB3 | 1 | 39 | 2 |
|* 17 | INDEX UNIQUE SCAN | (PK_TAB4) | 1 | 13 | |
| 18 | TABLE ACCESS FULL | TAB5 | 82 | 4264 | 2 |
| 19 | VIEW PUSHED PREDICATE | View3 | 1 | 13 | |
| 20 | NESTED LOOPS | | 1 | 52 | 2 |
| 21 | NESTED LOOPS | | 1 | 39 | 2 |
|* 22 | INDEX UNIQUE SCAN | (PK_TAB6) | 1 | 13 | 1 |
|* 23 | INDEX RANGE SCAN | (PK_TAB7) | 1 | 26 | 1 |
|* 24 | INDEX UNIQUE SCAN | (PK_TAB8) | 1 | 13 | |
| 25 | TABLE ACCESS BY INDEX ROWID| TAB9 | 3 | 78 | 1 |
|* 26 | INDEX UNIQUE SCAN | (PK_TAB9) | 1 | | |
|* 27 | INDEX UNIQUE SCAN | (PK_TAB10) | 1 | 13 | |
|* 28 | TABLE ACCESS BY INDEX ROWID | TAB1 | 12 | 25224 | 1 |
|* 29 | INDEX UNIQUE SCAN | (PK_TAB1) | 1 | | |
Predicate Information (identified by operation id):
2 - filter(ROWNUM<=3)
6 - filter("TAB2"."CERT_SERIAL_NUM"=30003)
14 - access("TAB5"."PATH_ID"="TAB4"."PATH_ID")
16 - filter("TAB3"."AUTH_GROUP_ID"<>(-1) AND ("TAB3"."AUTH_GROUP_ID"=0 OR "TAB3"."AUTH_GROUP_ID"=1))
17 - access("TAB3"."PATH_ID"="TAB4"."PATH_ID")
22 - access("TAB5"."DOMAIN_ID"="TAB6"."DOMAIN_ID")
23 - access("TAB6"."DOMAIN_ID"="TAB7"."DOMAIN_ID")
24 - access("TAB7"."RULE_ID"="TAB8"."RULE_ID")
26 - access("TAB9"."POLICY_ID"="TAB5"."POLICY_ID")
27 - access("TAB9"."ASSOCIATED_FORM_ID"="TAB10"."FORM_ID")
28 - filter("VIEW2"."POLICY_ID"="TAB1"."POLICY_ID")
29 - access("TAB1"."TRANSACTION_ID"="TAB2"."TRANSACTION_ID")
Note: cpu costing is off
53 rows selected.
Elapsed: 00:00:08.29
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 COLLECTION ITERATOR (PICKLER FETCH) OF 'DISPLAY'
Statistics
1079 recursive calls
0 db block gets
597 consistent gets
21 physical reads
0 redo size
5177 bytes sent via SQL*Net to client
405 bytes received via SQL*Net from client
5 SQL*Net roundtrips to/from client
63 sorts (memory)
0 sorts (disk)
53 rows processed
3) Execution Plan for VIEW1 <<-- Without any "ORDER BY" clause
SQL> explain plan for SELECT TO_CHAR(QT.TRANSACTION_ID), QT.POLICY_ID, QT.REQUEST_TYPE
2 FROM <VIEW1> QT WHERE QT.CERT_SERIAL_NUM=30003 AND
3 (QT.AUTH_GROUP_ID=0 OR QT.AUTH_GROUP_ID=1) AND ROWNUM <= 3 ORDER
4 BY TRANSACTION_ID ASC
5 /
Explained.
Elapsed: 00:00:10.20
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 3 | 213 | 11 |
| 1 | SORT ORDER BY | | 3 | 213 | 11 |
|* 2 | COUNT STOPKEY | | | | |
| 3 | NESTED LOOPS | | 17 | 1207 | 10 |
| 4 | MERGE JOIN CARTESIAN | | 1 | 32 | 9 |
| 5 | VIEW | VIEW2 | 1 | 26 | 8 |
| 6 | SORT UNIQUE | | 1 | 156 | 8 |
| 7 | NESTED LOOPS | | 1 | 156 | 6 |
| 8 | NESTED LOOPS | | 1 | 143 | 6 |
| 9 | NESTED LOOPS OUTER | | 1 | 117 | 5 |
|* 10 | HASH JOIN | | 1 | 104 | 5 |
| 11 | NESTED LOOPS | | 1 | 52 | 2 |
|* 12 | TABLE ACCESS FULL | TAB3 | 1 | 39 | 2 |
|* 13 | INDEX UNIQUE SCAN | PK_TAB4 | 1 | 13 | |
| 14 | TABLE ACCESS FULL | TAB5 | 82 | 4264 | 2 |
| 15 | VIEW PUSHED PREDICATE | VIEW3 | 1 | 13 | |
| 16 | NESTED LOOPS | | 1 | 52 | 2 |
| 17 | NESTED LOOPS | | 1 | 39 | 2 |
|* 18 | INDEX UNIQUE SCAN | PK_TAB6 | 1 | 13 | 1 |
|* 19 | INDEX RANGE SCAN | PK_TAB7 | 1 | 26 | 1 |
|* 20 | INDEX UNIQUE SCAN | PK_TAB8 | 1 | 13 | |
| 21 | TABLE ACCESS BY INDEX ROWID| TAB9 | 3 | 78 | 1 |
|* 22 | INDEX UNIQUE SCAN | PK_TAB9 | 1 | | |
|* 23 | INDEX UNIQUE SCAN | PK_TAB10 | 1 | 13 | |
| 24 | BUFFER SORT | | 1 | 6 | 9 |
| 25 | TABLE ACCESS BY INDEX ROWID | TAB2 | 1 | 6 | 1 |
|* 26 | INDEX RANGE SCAN | TAB2_IDX2 | 1 | | |
|* 27 | TABLE ACCESS BY INDEX ROWID | TAB1 | 12 | 468 | 1 |
|* 28 | INDEX UNIQUE SCAN | PK_TAB1 | 1 | | |
Predicate Information (identified by operation id):
2 - filter(ROWNUM<=3)
10 - access("TAB5"."PATH_ID"="TAB4"."PATH_ID")
12 - filter("TAB3"."AUTH_GROUP_ID"<>(-1) AND ("TAB3"."AUTH_GROUP_ID"=0 OR "TAB3"."AUTH_GROUP_ID"=1))
13 - access("TAB3"."PATH_ID"="TAB4"."PATH_ID")
18 - access("TAB5"."DOMAIN_ID"="TAB6"."DOMAIN_ID")
19 - access("TAB6"."DOMAIN_ID"="TAB7"."DOMAIN_ID")
20 - access("TAB7"."RULE_ID"="TAB8"."RULE_ID")
22 - access("TAB9"."POLICY_ID"="TAB5"."POLICY_ID")
23 - access("TAB9"."ASSOCIATED_FORM_ID"="TAB10"."FORM_ID")
26 - access("TAB2"."CERT_SERIAL_NUM"=1022)
27 - filter("VIEW2"."POLICY_ID"="TAB1"."POLICY_ID")
28 - access("TAB1"."TRANSACTION_ID"="TAB2"."TRANSACTION_ID")
Note: cpu costing is off
52 rows selected.
Elapsed: 00:00:03.37
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 COLLECTION ITERATOR (PICKLER FETCH) OF 'DISPLAY'
Statistics
38 recursive calls
0 db block gets
287 consistent gets
0 physical reads
0 redo size
5006 bytes sent via SQL*Net to client
405 bytes received via SQL*Net from client
5 SQL*Net roundtrips to/from client
29 sorts (memory)
0 sorts (disk)
52 rows processed -
*Urgent*How to insert data from MS SQL to the table that create at the adobe form?
Hi,
I'm using Adobe life cycle designer 8 to do my interactive form. I would like to ask how to insert data from MS SQL to the table that i have created in my adobe interactive form?
I really need the information ASAP as i need to hand in my project by next week... i really appreciate any one who reply this post.
ThanksTou need to do a couple of things
1. On the Essbase server, set up an odbc system connection to your MySQL database
2. In the load rule , go to the file menu and select open SQL data source and in the data source put in your SQL statement . A couple of hints. Where it says Select, don't put in the word select and where it say from don't put in from. The system adds them for you. The easiest way ti enter a SQL statement is to do it all in the select area So if your SQL would normanlly say select * from mytable just enter the code as * from mytable in the select area
The click ol/retrieve and enter in your connection info. Itshould bring data back into the load rule. Save the load rule and use it
Maybe you are looking for
-
How to globally change straight double quotes to curly open and close?
I am editing with InDesign (5.5) some documents created by others. I suddenly noticed that the double quote marks were straight, not curly, in one document and Find/Change does not seem to offer and option to distiguish the open (left) double quote m
-
How do i connect three external monitors to a macbook pro?
How do I connect three extrenal monitors to my Macbook Pro?
-
Can't scan with Epson Stylus DX4450
Hi everybody. I'm trying to configure my Epson Stylus DX4450. Printing works like a charm, but scanner is not. I tried to configure it as it was suggested on various websites. I've installed sane, xsane, iscan (from http://repo.archlinux.fr/i686) als
-
How do I view all of my line's messages and calls showing dates and times? I did it once but can't remember how to get to the screen again.
-
FM to get Fund/Fund Center/Commitment Item- Item level total (FMBB)
Hi, 1. How to get line item level total of of document created in Fund Management with FMBB tcode? Is there a Function Module for the same? The data stored in FMBH/FMBL are period wise. 2. Is there any way we can change Prepost amount of a FM documen