Can't Export data if WHERE clause contains AND/OR
I am able to export the results of a query if the WHERE clause only has one condition. But if there is and AND or an OR, you can right-click and choose Export Data, but nothing happens.
For example, the following will Export just fine:
SELECT * FROM DUAL
WHERE ROWNUM = 1;
But throw in an 'AND', and it won't Export:
SELECT * FROM DUAL
WHERE ROWNUM = 1 AND ROWNUM < 2;
I am running Ver 1.5.3 and haven't applied any patches.
Unfortunately, as part of trying to fix other issues with the export functionality, 1.5.3 introduced problems where certain types of SQL statements wouldn't export (either nothing happened as you are seeing or reporting error messages like ORA-936). While it is not yet perfect, 1.5.5 handles exporting results much better (it copes with your case that fails in 1.5.3), so I would suggest you upgrade to 1.5.5.
theFurryOne
Similar Messages
-
Hello all,
I am new to Oracle, currently using 10G + aspvbscript.
I've been trying to query data using date in where clause but nothing seems to work.
The column is in date format.
It gets printed out like this: 5/1/2010 11:21:19 AM
I tried using this query:
SELECT * from table where TRUNC(user_date) > to_date('FEB-01-2010:00:00:00','mm-dd-yyyy:HH24:MI:SS') order by user_date asc.
It does return an output but it returns everything in table and does not take WHERE clause into consideration however, it does sort the date in ascending order.
I've tried getting rid of TRUNC tried to format date in a different way but no such luck.
Please point me to the right direction.
Thanks.Welcome to the forums!
In cases like this it is helpful if you can provide the following information:
1. Oracle version (SELECT * FROM V$VERSION)
2. Sample data in the form of CREATE / INSERT statements.
3. Expected output
4. Explanation of expected output (A.K.A. "business logic")
5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
I'll try and take a stab at your request based on the data given. What your query says is that it will return all rows that have a date greater then 2/1/2010 (MM/DD/YYYY). If your query is returning all rows then maybe the possibility exists that all the dates in the table are greater then 2/1/2010. Have you checked all dates to see if this is the case?
Also, one note about your TO_DATE() function.to_date('FEB-01-2010:00:00:00','mm-dd-yyyy:HH24:MI:SS')The date format does not match the string you are using with respect to month. Your string has 'FEB' but the format is 'MM' which is the numeric representation of the month. Although Oracle was able to convert it to the proper date on my system you should try and maintain consistency between the string and the date format used. -
1.5.3 can't export data
when I choose the "export data..." ,there is no option window open, so I can't export data,what's the matter? anybody can help me thanks!
Since I believe this information is somehow usefull I´ll post it here too.
Test 1
Oracle SQL Developer Version 1.5.3 Build MAIN-5783 (downloaded yesterday / running on Windows XP SP3 Java 1.5)
Oracle Database 11g (running on RH5)
When trying to export the follow queries I got:
Query / What?
select table_name, tablespace_name, cluster_owner from user_tables
Export Ok
select table_name, (select table_name from user_tables where rownum < 2), cluster_owner from user_tables
Export Fail - Nothing happen (No errors, no export dialog window, nothing)
select table_name, (case table_name when 'USERS' then 'USERS!' else table_name end), cluster_owner from user_tables
Export Fail - ORA-00907 "missing right parenthesis" - Vendor code 907
select table_name, (select table_name from user_tables where rownum < 2) simple_alias, cluster_owner from user_tables
Export Ok
select table_name, (case table_name when 'USERS' then 'USERS!' else table_name end) simple_alias, cluster_owner from user_tables
Export Ok
select table_name, (case table_name when 'USERS' then 'USERS!' else table_name end) as simple_alias, cluster_owner from user_tables
Export Fail - ORA-00907 "missing right parenthesis" - Vendor code 907
select table_name as simple_aliasb, (case table_name when 'USERS' then 'USERS!' else table_name end) simple_alias, cluster_owner from user_tables
Export Ok
Test 2
Oracle SQL Developer Version 1.5.1 Build MAIN-5440 (running on Windows XP SP3 Java 1.5)
Oracle Database 11g (running on RH5)
When trying to export the follow queries I got:
Query / What?
select table_name, tablespace_name, cluster_owner from user_tables
Export Ok
select table_name, (select table_name from user_tables where rownum < 2), cluster_owner from user_tables
Export Fail - ORA-00972 "identifier is too long" Vendor code 972
select table_name, (case table_name when 'USERS' then 'USERS!' else table_name end), cluster_owner from user_tables
Export Fail - ORA-00972 "identifier is too long" Vendor code 972
select table_name, (select table_name from user_tables where rownum < 2) simple_alias, cluster_owner from user_tables
Export Ok
select table_name, (case table_name when 'USERS' then 'USERS!' else table_name end) simple_alias, cluster_owner from user_tables
Export Ok
select table_name, (case table_name when 'USERS' then 'USERS!' else table_name end) as simple_alias, cluster_owner from user_tables
Export Ok
select table_name as simple_aliasb, (case table_name when 'USERS' then 'USERS!' else table_name end) simple_alias, cluster_owner from user_tables
Export Ok
I hope that help!
Thanks in advance,
FBertaglia -
Can i use Decode in Where clause
Hi,
Can i use Decode in Where clause Please Do the need full on the same.
Thanks,
Sanjeev.set serveroutput on
DECLARE
posn PLS_INTEGER := 0;
empid PLS_INTEGER := 178;
x NUMBER;
BEGIN
SELECT NVL(SUM(ah.quantity * ah.saleprice * ap.payoutpct), 0)
INTO x
FROM accessoryhistory ah, payoutpercentage ap,
sku s, store st
WHERE empid = DECODE(posn,
0, st.areadir,
1, st.areamgr,
2, NVL(st.storemgr1, st.storemgr2),
3, NVL(st.asstmgr1, NVL(st.asstmgr2,
st.asstmgr3)))
AND ah.statustype IN ('ACT', 'DEA')
AND ah.store = st.store
AND s.dbid = ah.dbid
AND s.sku = ah.sku
AND ap.productgroup = s.productgroup
AND ap.position = posn;
dbms_output.put_line(x);
END;
/http://psoug.org/reference/decode_case.html -
Can we call Data flow Task as Container
Hi All,
Can we call Data flow Task as Container If So what are conditions required to Satisfy as a Container
Thanks
RavindraHi kavali1985,
Containers are objects in SQL Server Integration Services that provide structure to packages and services to tasks. They support repeating control flows in packages, and they group tasks and containers into meaningful units of work. Containers can include
other containers in addition to tasks.
Packages use containers for the following purposes:
• Repeat tasks for each element in a collection, such as files in a folder, schemas, or SQL Server Management Objects (SMO) objects.
• Repeat tasks until a specified expression evaluates to false.
• Group tasks and containers that must succeed or fail as a unit.
The Data Flow task encapsulates the data flow engine that moves data between sources and destinations, and lets the user transform, clean, and modify data as it is moved. Addition of a Data Flow task to a package control flow makes it possible for the package
to extract, transform, and load data. We can add Data Flow task to Containers, but Containers can’t be included in Data Flow tasks.
Reference:
Integration Services Containers
Data Flow Task
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
I can only export in flash player, flash professional, and premiere pro
Hi,
I just got the CS5 production DVD's. I only installed AE on my macbook pro osx 10.6.8.
When I go to export my project/composition I only have 3 options, i can only export in flash player, flash professional, and premiere pro.
Where are the options to export as a quicktime movie and all the others?
Do I have to install the entire suite for these options to appear?
If so, why?
Thanks,
JasonRender Queue.
More importantly, for the newly initiated, some time spent here would go a long way. -
How can I export the very cool Lightroom Map and link to the photos which show on the map?
How can I export the very cool Lightroom Map and link to the photos which show on the map?
I love the way Lightroom imported my .gpx files, automatically geocoded the photos, and show where I took them on the map.
Would love to export this lovely map and the photos which have been geocoded to the map.
Anyone know how to export this as an HTML file I can import into my web site.
I'm a Realtor in Berkeley, and integration of the elegant map and the photos. It would be perfect way to show my clients where the homes are, and what they look like.
IraYou probably didn't get an answer because none exists within Lightroom.
You can perform a screen caputre of the Lightroom map, and use the resulting JPG/GIF of your screen, however there is no way to hyperlink the point on the map to your photos.
You might want to consider a non-Lightroom solution, such as uploading the photos to an Album on Flickr (or one of many other photo sharing web sites) and using the mapping capabilites there, which would be hyperlinked to your photos, see example below. You can use Lightroom to geotag the photos and then use Lightroom to upload to Flickr (or other web site) and then use the web site to create and display the map -
I have an iPod with iOS 4.2.1 and would like to up date to version 5. The pc I normally sync with has XP operating system. So I can't up date to iTunes 10. And my iPod doesn't show the software update button shown in the article. What can I do?
You cannot update it if you can't get the latest version of iTunes. Actually, the latest version of iTunes will run in XP if you have Service Pack 2. Also, you posted in the iPad forum, and your profile shows you have an iPad, but in your post, you say it is an iPod. Is it an iPad or an iPod?
-
Export (expdp) with where clause
Hello Gurus,
I am trying to export with where clause. I am getting below error.
Here is my export command.
expdp "'/ as sysdba'" tables = USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= “USER1.TABLE1:where auditdate>'01-JAN-10'” Here is error
[keeth]DB1 /oracle/data_15/db1> DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate>'01-JAN-10' <
Export: Release 11.2.0.3.0 - Production on Tue Mar 26 03:03:26 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_TABLE_03": "/******** AS SYSDBA" tables=USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 386 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/TRIGGER
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
ORA-31693: Table data object "USER1"."TABLE1" failed to load/unload and is being skipped due to error:
ORA-00933: SQL command not properly ended
Master table "SYS"."SYS_EXPORT_TABLE_03" successfully loaded/unloaded
Dump file set for SYS.SYS_EXPORT_TABLE_03 is:
/oracle/data_15/db1/TABLE1.dmp
Job "SYS"."SYS_EXPORT_TABLE_03" completed with 1 error(s) at 03:03:58Version
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - ProductionHello,
You should use parameter file.Another question i can see you are using 11g.Why don't you use data pump?.
Data Pump is faster and have more features and enhancement than regular imp and exp.
You can do the following:
sqlplus / as sysdba
Create directory DPUMP_DIR3 for 'Type here your os path that you want to export to';then touch a file:
touch par.txt
In this file type the following the following :
tables=schema.table_name
dumpfile=yourdump.dmp
DIRECTORY=DPUMP_DIR3
logfile=Your_logfile.log
QUERY =abs.texp:"where hiredate>'01-JAN-13' "then do the following
expdp username/password parfile='par.txt'
If you will import from Oracle 11g to version 10g then you have to addthe parameter "version=10" to the parameter file above
BR
Mohamed ELAzab
http://mohamedelazab.blogspot.com/ -
Can we export DATA from all tables in a schema?
Hi,
I have a question; Can we export all the DATA from all the tables present in the schema to any source (eigther CSV, TXT, DAt, etc..)?
Or
Can I have a PL/SQL procedure to display DATA from all Tables in a schema?
With Best Regards,
- NaveedHi,
This is pretty much what you need.
DECLARE
V_COUNT NUMBER;
v_sql varchar2(1000);
IN_OWNER_NAME VARCHAR2(100) := 'AP' ; -- SCHEMA NAME
TYPE T_COL_NAME is table of varchar2(1000) index by binary_integer;
v_col_tbl t_col_name;
BEGIN
FOR i in
(SELECT object_name
FROM dba_objects
WHERE owner = IN_OWNER_NAME
AND object_type ='TABLE'
and rownum < 2)
LOOP
v_sql := 'SELECT COUNT(*) FROM ' || i.object_name ;
EXECUTE IMMEDIATE v_sql INTO V_COUNT;
if v_count > 0 then
v_sql := 'SELECT * FROM ' || i.object_name ;
select column_name
bulk collect
into v_col_tbl
from DBA_TAB_COLUMNS
WHERE TABLE_NAME = I.OBJECT_NAME
AND OWNER = IN_OWNER_NAME;
-- start selecting the column and exporting using the column names selected.
end if;
if v_col_tbl.count > 0 then
for i in v_col_tbl.first .. v_col_tbl.last
loop
DBMS_OUTPUT.PUT_lINE(v_col_tbl(i));
end loop;
end if;
DBMS_OUTPUT.PUT_lINE( i.object_name || '-' || v_count);
END LOOP;
END;
- Ronel -
Can not export data from form tracker
Hi there,
I have set up a lovely form for collecting data. It all comes into the Adobe Tracker and the Responses file fine.
What i wish to do is export data from the responses file into another format. I should be able to do it from the Export button on the left but it is 'blanked out' and does nothing if I push it. I can't find any details on here or the internet relating to this. And yes, there is data in the file to export .
Hoping you can help.
Many thanks in advance.I have the same problem but... I created two forms for two separate purposes and have had responses to both.
One of them allows me to export the data and the other does not.
Does anyone out there have an answer for this seemingly random anomoly?
Regards
Sydman -
Query with date in where clause
hi,
i have build a view with join conditions from 8 tables. the data from this view is more then 100,000
when i run the query with different clause its work with some seconds. but when i put date column in where cluase it sleeps.
eg..
where unit_id = 4 and t_id = 's09' and vb like '%amb%'
works fine.
where unit_id = 4 and t_id = 's09' and vb like '%amb%' and date between dt1 and dt2
now sleep
please ......give me some suggestionshi i have done the explain plan
the result is
Operation Object
SELECT STATEMENT ()
NESTED LOOPS ()
NESTED LOOPS ()
HASH JOIN ()
HASH JOIN ()
TABLE ACCESS (FULL) PR_PO_MST
TABLE ACCESS (FULL) PR_SUPPLIER
TABLE ACCESS (FULL) PR_PO_DTL
TABLE ACCESS (BY INDEX ROWID) INDENT_MST
INDEX (RANGE SCAN) ST_IND_MST_IDX
TABLE ACCESS (BY INDEX ROWID) ST_ITEM
Operation Object
INDEX (UNIQUE SCAN) PK_ST_ITEM
now wot do do???? -
Can we use Case in Where Clause along with Exists
Hi Everybody,
Can we use Case in the where clause with exists? As i have a requirement in which i have to check whether value exists in 6 views, now depending on some value(gns_type )of select clause i have to attach a paticular exists else the performance dies.
Please go through the query any suggestion appreciated.
Thanks
SELECT count(*)
FROM
(SELECT eah.changed_date,
decode(eua.is_deleted, 'N', decode(eah.alert_type, NULL, 'GN', 'R', 'GAR', 'G', 'GAG', 'Y', 'GAY'), 'Y', decode(eah.alert_type, 'R', 'GDR', 'G', 'GDG', 'Y', 'GDY', NULL, 'GN'), NULL, 'GN') AS
alert_type,
decode(eac.pta_line, 'N', '') ptaline,
eac.exp_type_desc,
eac.supplier_name,
eac.transaction_id,
eah.gns_type,
eac.po_amount,
eac.po_end_date,
eah.notes,
eua.is_deleted,
eac.expenditure_type,
eua.gns_alert_summary_id,
eah.changed_date alert_date,
eua.user_alert_id,
eah.reference_number,
decode(eac.cms_pta_line,'N','',eac.cms_pta_line) cms_pta_line,
cms_po_amount,
cms_po_end_date,
mgns.is_decommitted,
eac.gns_alert_id,
eah.gns_type source_name
FROM xxdl.xxdl_sc_gns_alerts_summary eah,
xxdl.xxdl_sc_gns_detail_alerts eac,
xxdl.xxdl_sc_gns_user_alerts eua,
xxdl.xxdl_sc_manage_gns_master mgns
WHERE eah.gns_alert_summary_id = eac.gns_alert_summary_id
AND eah.gns_alert_summary_id = eua.gns_alert_summary_id
AND eah.transaction_id = eac.transaction_id
AND eah.transaction_id = mgns.transaction_id)
a
WHERE(EXISTS
(SELECT 1
FROM xxdl_sc_mng_gns_pta_req_hc_v x
WHERE x.transaction_id = a.transaction_id
AND x.source_name = a.source_name
AND x.project_id = 69309
AND x.task_id = 242528
AND x.award_id = 34694)
OR
EXISTS( SELECT 1
FROM xxdl_sc_mng_gns_pta_inv_hc_v x
WHERE x.transaction_id = a.transaction_id
AND x.source_name = a.source_name
AND x.project_id = 69309
AND x.task_id = 242528
AND x.award_id = 34694)
OR
EXISTS(SELECT 1
FROM xxdl_sc_mng_gns_pta_req_sc_v x
WHERE x.transaction_id = a.transaction_id
AND x.source_name = a.source_name
AND x.project_id = 69309
AND x.task_id = 242528
AND x.award_id = 34694)
OR
EXISTS(SELECT 1
FROM xxdl_sc_mng_gns_pta_inv_sc_v x
WHERE x.transaction_id = a.transaction_id
AND x.source_name = a.source_name
AND x.project_id = 69309
AND x.task_id = 242528
AND x.award_id = 34694)
OR
EXISTS( SELECT 1
FROM xxdl_sc_mng_gns_pta_po_sc_v x
WHERE x.transaction_id = a.transaction_id
AND x.source_name = a.source_name
AND x.project_id = 69309
AND x.task_id = 242528
AND x.award_id = 34694)
OR
EXISTS (SELECT 1
FROM xxdl_sc_mng_gns_pta_po_hc_v x
WHERE x.transaction_id = a.transaction_id
AND x.source_name = a.source_name
AND x.project_id = 69309
AND x.task_id = 242528
AND x.award_id = 34694)
AND TRUNC(alert_date) >= TRUNC(add_months(sysdate, -1))
AND TRUNC(alert_date) <= TRUNC(sysdate)
AND is_deleted = 'N'
ORDER BY changed_date DESCyou can do
WHERE
CASE WHEN (something) THEN
CASE WHEN EXISTS (SELECT * from ...) THEN 1 ELSE 0 END
WHEN (something else) THEN
CASE WHEN EXISTS (SELECT * from ...) THEN 1 ELSE 0 END
END = 1Looking at your current query, it looks like all those exist statements could be a lot neater, maybe like:
WHERE (69309,242528,34694) IN
(SELECT project_id,task_id,award_id FROM
(Select project_id,task_id,award_id,transaction_id,source_name
FROM
xxdl_sc_mng_gns_pta_req_hc_v
UNION ALL
Select project_id,task_id,award_id
xxdl_sc_mng_gns_pta_inv_hc_v
...) x
where a.transaction_id = x.transaction_id
and a.source_name = x.source_name
)or put the tuple in the where clause at the bottom -
Using multiple dates in WHERE clause
I have a multiple select box in a form. I am trying to select
records in SQL using the list that this form field produces. They
are dateTime values. How do I use this list in the WHERE clause of
my select statement?Man, I really hate posting anywhere near Dan - I've been
watching his mastery for years. (Talk about the big leagues) But
here goes anyway...
I've gotten my little behind kicked by more than a view date
issues, and I have basically gotten away from exact matches (unless
you really need them).
I'd probably do something like this:
SELECT field1,field2...
WHERE datetime_column_in_db > (OR LTE,OR GT/LT)
'#datetimeformatyoulike(form.datetimevalue1)#
Basically, finding records in RELATION to the form's datetime
value has always been much easier for me.
And God (and Dan) have mercy on my soul... -
Hi,
I have query which i used to display the new status that happend. Here in the where clause i am checking the dates for comparisiion but the query say no data found
But data found in the table Please suggest how to put a join condition on dates. or is there any other way to write this query
select distinct SDM from PROJECT_START_UP
where project_name = :p1_projects and
check_id = 44 and
CREATION_DATE like (select max(CREATION_DATE) from project_start_up where check_id = 44)
Thanks
SudhirWhy you're using LIKE operator instead of '='??
Please try whether you have data
select distinct SDM from PROJECT_START_UP
where project_name = :p1_projects and
check_id = 44 If above query returned data, then run
select distinct SDM from PROJECT_START_UP
where project_name = :p1_projects and
check_id = 44 and CREATION_DATE = (select max(CREATION_DATE) from project_start_up where check_id = 44)- - - - - - - - - - - - - - - - - - - - -
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
Maybe you are looking for
-
I am having problems with updating and downloading from my mac to my ipod, won't download at all. any advice?
-
CiscoWorks LMS 4.0.1 - Database inconsistency
Hello all, I have a problem with LMS 4.0.1. In the Inventory / Device Administration, I see all the devices, monitoring works perfect (highutilization, operationallydown, etc.). User Tracking works fine for 85% of the devices (15% is the newer device
-
Itunes Match upload keeps failing
Hey there, I signed up for iTunes Match yesterday and it's matched up most of my library but it's just started running the Step 3 "Uploading Artwork And Remaning Songs" FOR THE THIRD TIME - it gets all the way through the process then I turn around t
-
In MSC2n - Get date in the classification tab from basic data 1 tab
Hi All, My requirement is as follows. WHen I execute the tcode MSC2N, Relevent data for the fields Batch, Material and Plant and hit the enter Key. This displays Tabs like BASIC DATA1, BASIC DATA 2 , CLASSIFICATION etc. when I change the production
-
I'm doing a search to find files in a folder that end with .cfg. There should be two files like this in the directory. But, if there are 3 files I would like to know. This is the code I'm using to find the file names. FilenameFilter f