Oracle 9i bad SELECT result?
Hi people,
Here is a doozy for everyone....
Can someone please explain the following behaviour to me?
I was trying to setup some test data for a unit test ( I wanted to select a random row from a data table ). Okedokey, off I went and constructed the data table with full precision timestamps for every hour in the current year. Now to construct some random time ranges, I want to select the results of a random row in that table. Ah ha! 9i's analytics to the rescue.
DOH! It didn't work... without the counter-intuitive rownum restriction on dual it randomly returns no rows, multiple rows and more importanly rows that do NOT fulfil the criteria of b.n_row being equal to a.n_random_row. To get it to work I need to put the patently ridiculous ROWNUM = 1 against the DUAL inline view .... Any ideas what is going wrong?
=============== SETUP =================
create table tmp_timeline ( t_timestamp timestamp(9) with time zone );
insert into tmp_timeline
select to_timestamp_tz( '01-JAN-2002 00:00:00 +10:00', 'DD-MON-YYYY HH24:MI:SS TZH:TZM' ) + rownum / 24 t_timestamp
from all_objects, all_objects
where rownum < 8760;
=============== SETUP ====================
=============== ERRONEOUS? SQL =============
select to_char( t_timestamp ) "timestamp",
n_row,
n_random_row
from
-- ( 8759 is the count(*) of rows in table tmp_timeline )
select trunc( dbms_random.value( 1, 8759 ) ) n_random_row
from dual
-- where rownum = 1
-- ???? Uncommenting the nonsense line above this one fixes!
) a
inner join
select tt.t_timestamp,
row_number() over ( order by tt.t_timestamp ) n_row
from tmp_timeline tt
) b
on b.n_row = a.n_random_row
=============== ERRONEOUS? SQL =============
I was under the impression that DUAL is designed to return exactly ONE row. Is my understanding of INNER JOIN and DUAL somehow cockeyed or is there something weird going on with the function execution?
Please shed some light on this if you have any ideas!
Thanks,
Lachlan Pitts
[select * from v$version]
Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
PL/SQL Release 9.0.1.1.1 - Production
CORE 9.0.1.1.1 Production
TNS for 32-bit Windows: Version 9.0.1.1.0 - Production
NLSRTL Version 9.0.1.1.1 - Production
Partition Outer Joins is the feature of Oracle 10g not 9i
i think u r confuse with Analytical Functions Partition by thing.... Analytical functions are available since 8i
Syntax for 10g Partition by
SELECT ...
FROM ...
PARTITION BY (expr [,expr ]... )
RIGHT OUTER JOIN table_referenceBaig
[My Oracle Blog|http://baigsorcl.blogspot.com/]
Similar Messages
-
Purchase Order restrict selection result
Hi experts!
We are on SRM5.0 in ECS.
When a user search Purchase order in the 'Change Purchase Order' transaction BBP_POC he will be able to see all purchase orders within the company.
Actually there is the possibility to restrict the selection results by purchasing organization or purchasing group, but this is not usefull for us. Is there any other object we can use?
Many thanks for your help.
Best regards,
CorinneHello,
You could use the badi BBP_WF_LIST to filter this list at your convenience.
You also could use structural authorization (tx OOSB, OOSP).
Rgds,
Pierre -
Does the bad formance results from Virtual Machine?
My Oracle 10g testing database is runing on a Virtual Mchine and its performance is not good. Does the bad formance results from Virtual Machine?
Though the resources are enough, I still think the virtual machine can damage the performance. Does any one has the same experience?
Thank youAnswered the same just a while ago...
Can Virtual Machin system make negative impact to the database performance? -
Select results different in sqlplus and xsql
I'm having problems selecting data from a varchar2 column in my database. The problem occurs when the data contains parentheses. If I insert 'javascript:schedule()' into the column, I can retrieve the data using sqlplus, but the same select statement in xsql returns no data. If I insert 'javascript:schedule' into the column both methods (after restarting Oracle and Apache) display the same (valid) results.
Is there a restriction on the characters that can be returned in an xsql:query? If so, what are the restrictions, and how can I get around them?
On a side note, how can I prevent Oracle from caching the results of the xsql:query? It may be fine to cache this when the site is in production, but right now it just makes life more difficult.
Thanks
-mHi,
I have almost the same results between Matlab and Labview now. The problem was that I didn't know exactly what I was reading with Matlab and not with Labview.
The new problem is that my resolution is 320x240 which should give a 1D array of 76800 elements, that I get with Matlab. Labview gives me the same array but only for the 22528 first elements, and only 0 after...
I think the problem comes from the byte stream type but i kept the same format (uint16)!
Edit : I tried to read the data as double 64bits (because with Matlab the reading transforms uint16 in double) but the size of the array doesn't change...Any Idea ?
Thanks!
Ps: I can upload the subVIs but the data is too heavy (30Gb)
Message Edited by christophe69000 on 06-19-2009 07:03 AM -
How can i get select result in varray
Hi,
I am new in oracle. I have the following sproc it return around 500 records but OCCI takes long time to get all records due to one-by-one records fetch.
TYPE rec_type is record ( f1 integer, f2 integer, f3 integer,f4 integer );
TYPE id_rec_type IS REF CURSOR RETURN rec_type;
PROCEDURE get_s_data (
v_s IN VARCHAR2,
v_p IN INTEGER ,
v_d IN INTEGER ,
o_cd OUT NUMBER ,
o_id OUT id_rec_type ) IS
BEGIN
DECLARE
v_start_date DATE;
BEGIN
select get_start_date(TO_CHAR(SYSDATE,'DD-MON-YYYY') ,-1* v_d ) into v_start_date from dual;
OPEN o_id FOR
SELECT f1 , f2 , f3, f4
FROM T1
WHERE s1 = v_s
AND timestamp >= v_start_date;
END;
I want to convert above sproc in VARRAY/Table to utilize bulk fetch
I am not sure how to convert multicolumns select result in varray.
example in document use only one column in varray from select statement.
some exmple use cursor with bulk fetch but problem is cursor need to define in declare section.
I have one condition in where clause and get calculate in sproc.
any suggestion?thanks for reply.
It doesn't work with ref cursor as output parameter in sproc.
Please see my post in OCCI forums.
Performance problem with sproc and out parameter ref cursor
after spending some time found one way.
prcedure p1 ( i1 IN integer , i2 IN integer, v1 OUT varray_type )
declare
cursor c1 is
select c1 , c2 , c3 , c4
from t1
where c1 > i1 and c2 > i2;
begin
open c1;
fetch c1 bulk collect into v1;
close c1;
end;
procedure p2 ( v1 OUT varry_type )
declare
i1 integer
i2 integer
begin
i1 := new_calculate_value(i2);
i3 := calculate_s(i2);
p1(i1,i3,v1);
end;
above method allow us to calculate where clause value before cursor define and get filter data.
I am working OCCI to get varray from above method. -
How to show the SELECT result in a certain form?
Hallo,
I have the folling problem:
CREATE TABLE buildings (
building VARCHAR2(20) NOT NULL,
city VARCHAR2(20) NOT NULL,
no_of_buildings NUMBER NOT NULL);
Now I make a SELECT * FROM buildings:
building city no_of_buildings
School Rome 20
School Paris 30
Cinema New York 15
Theater London 10
Theater Rome 7
But I need the SELECT result in this form:
Rome Paris New York London
School 20 30 null null
Cinema null null 15 null
Theater 7 null null 10
Is this possible?
Thank you
WernerSorry,
my request is not formatted well. I try again:
Hallo,
I have the folling problem:
CREATE TABLE buildings (
building VARCHAR2(20) NOT NULL,
city VARCHAR2(20) NOT NULL,
no_of_buildings NUMBER NOT NULL);
Now I make a SELECT * FROM buildings:
building city no_of_buildings
School Rome 20
School Paris 30
Cinema New York 15
Theater London 10
Theater Rome 7
But I need the SELECT result in this form:
Rome Paris New York London
School 20 30 null null
Cinema null null 15 null
Theater 7 null null 10
Is this possible?
Thank you
Werner -
Sql (Select) result in string
Hi , I found this code in internet but it´s put a result in range on excel.
I would like some code with end is some like "MyVarString = objMySQLRecordsetResult"
For example: In my select result = "User01" , I would like put this value in a var string.
The code ends ...
'ActiveSheet.Range("A1").CopyFromRecordset objMyRecordset
I want ...
Test01 = Recordset objMyRecordset
tks for your help !!
Public Sub GetDataFromADO()
'Declare variables'
Dim objMyConn As ADODB.Connection
Dim objMyCmd As ADODB.Command
Dim objMyRecordset As ADODB.Recordset
Set objMyConn = New ADODB.Connection
Set objMyCmd = New ADODB.Command
Set objMyRecordset = New ADODB.Recordset
Dim TESTE01 As String
'Open Connection'
objMyConn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.15.0;Data Source="
& ActiveWorkbook.Path & "\Database.accdb" & "; Jet OLEDB:Database Password= `MY PASSWORD"
objMyConn.Open
'Set and Excecute SQL Command'
Set objMyCmd.ActiveConnection = objMyConn
objMyCmd.CommandText = "select DUSER from DUSER WHERE DUSER = 'USUR01 "
objMyCmd.CommandType = adCmdText
'Open Recordset'
Set objMyRecordset.Source = objMyCmd
objMyRecordset.Open
objMyRecordset.OpenRecordset
'Copy Data to Excel'
'ActiveSheet.Range("A1").CopyFromRecordset objMyRecordset
End SubTry:
Public Sub GetDataFromADO()
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
'Open Connection'
Conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.15.0;Data Source=" & ActiveWorkbook.Path & "\Database.accdb" & "; Jet OLEDB:Database Password= `MY PASSWORD"
Conn.Open
'Open Recordset'
Rs.Open "select DUSER from DUSER WHERE DUSER = 'USUR01'", Conn, adOpenDynamic, adLockReadOnly
'Copy Data to Excel'
ActiveSheet.Range("A1").CopyFromRecordset Rs
Rs.Close
Conn.Close
End Sub
Rod Gill
Author of the one and only Project VBA Book
www.project-systems.co.nz -
Generate update statement from select results
I'm trying to generate an update statement based off select statement results. A very basic example,
SELECT ListID FROM DListing WHERE Status = 2
Results return 3 rows.
1234
2345
3456
How can I take those results and turn them into WHERE criteria for UPDATE statement?
Generated UPDATE statement should look like this.
UPDATE DListing SET Status = 1 WHERE ListID IN (1234,2345,3456)
I have started by creating a temp table to hold my SELECT results, but I don't know how to get those results into format for IN condition. Right now I get 3 UPDATE statements with 1 ListID in each IN condition.
CREATE TABLE #TempStatusUpdate(ListID INT)
INSERT INTO #TempStatusUpdate
SELECT ListID FROM DListing WHERE Status = 2
SELECT 'UPDATE DListing SET Status = 1 WHERE ListID IN (' + CONVERT(VARCHAR(30),ListID) + ') AND Status = 2'
DROP TABLE #TempStatusUpdateSo what wrong with
UPDTATE DListing
SET Status = 1
WHERE ListID IN (SELECT ListID FROM #TempStatusUpdate)
Erland Sommarskog, SQL Server MVP, [email protected] -
Display User Selection Results on Cover Sheet of the Crystal Report
How do you display the result of a multi-level dynamic parameter that the user has selected on the cover sheet of the crystal report.
Or Display the Start & Ending selection results from a dynamic parameter on the cover sheet of the crystal report.Replace the code with:
stringvar selection;
stringVar array arr1;
numberVar i;
redim preserve arr1[count({?ProductID})];
for i := 1 to count({?ProductID}) step 1 do
arr1<i> := {?ProductID};
selection:= 'ProductID is : ' & chr(39) & join(arr1,",") & chr(39);
This should hopefully fix the error, but I don't think it will solve your problem as it might keep assigning the same product id to each element of the array.
Have you tried just join({?parameter},', ') as suggested by RG?
Edited by: Sanjay Kodidine on Jul 1, 2009 10:22 AM -
Including batchCharacteristics in'Selection Result forBatches' pane inBMBC
1. I create batch Class CUT_IRON (class type 022)
2. I create three characteristics (iron_colour, iron_width, & iron_alloy) & assign these three characteristics to Class CUT_IRON.
3. While creating batch managed material KR352NG, i assign Class CUT_IRON to this material in the Classification view.
4. When doing Confirmation of Prod Order (co15) for this material, a batch number is generated & these Characteristics Values filled for each batch.
5. In BMBC, how do I make settings so that for batches these Characteristics will be displayed in the ''Selection Result for Batches'' pane?Hello,
from transaction BMBC select the menu path "Utilities --> User settings" . In the field "User group selection" choose the entry: "SAP 2 SAP example 2: classification".
You can maintain these entries from customizing under "Logistics - General --> Batch Management --> Batch Information Cockpit --> Define User-Group-Specific Selection".
Hope to be useful.
Best regards,
Andrea -
Bad Scan result black page with color vertical lines
Why my HP Deskjet 1050 All in one printer Bad Scan result black page with color vertical lines ? i'm running on linux mint 17.
Hi , Welcome to the HP Forums! I understand that you are getting vertical lines with your scanning when using your HP Deskjet 1050 printer on Linux Mint 17. I am happy to look into this for you! What happens when you make copies with the printer? Copy Documents with Text and Graphics. Do you still see the vertical lines? In the meantime, please see this guide, Vertical Bands, Lines, or Streaks in Copies or Scans, and let me know what happens! Hope to hear from you soon! “Please click the Thumbs up icon below to thank me for responding.”
-
Submit of Podcast feed not working: "Bad http result 404"
I am trying to submit my .xml file to the "Submit
Podcasts to the iTunes Directory" and it keep sgiving me the error:
We had difficulty reading this feed. Bad http result code: 404"
Can anyone tell me what the error is? It does nothing to explain this. I've tried using an xml template for itunes that supposed to work but nothing. It works fine using iPodder.
Here's the link:
http://cmi.yale.edu/podcasts/rss/test5.xml
Thanks much for the help!Right, I know how the 404 mean error not found but i checked and double checked the URLs and they all seem fine to me as well. I can understand what iTunes is not liking about the feed. I've updated the feed with a new .xml:
http://cmi.yale.edu/podcasts/rss/cmi.xml - still getting the 404. Do you see anything wrong with the URLs?
Thanks much! -
HT1819 Bad http result code: 403
I've done everything up to this point: validate XML, manually subscribe through iTunes.
I'm at Submit Podcast to iTunes Directory
1. Podcast feed URL: http://www.thelambschapel.org/TLC_AudioPodcast.xml.
I get: Bad http result code: 403
The file permissions are 655. How can I get beyond this? Thx.
p.s. the only reason I am submitting the podcast is because our podcast of 3+ years dropped off the directory, so I'm trying to make the name slightly different in order to get it listed on the directory again. I changed the name of the XML file, and inside the file, I changed the <title>. The URL stays the same.The feed seems to be OK - it can be subscribed to manually in iTunes and works fine there.
The 403 error means 'Access forbidden': one way of getting this is trying to access a directory (ending a URL with a slash) when there is no index.html file present, so if for example you had accidentally added a slash to the end of the URL when submitting it that would probably be the result.
If you are sure that you submitted the URL correctly it's difficult to see what the problem is. Sometimes servers don't react properly to a request from the iTunes Store when requests from the iTunes application and other rss readers work fine. You would need to take this up with the people running your server. Possibly they have a log which will show what happened. -
Bad HTTP result Code: 404
I'm trying to submit a podcast to iTunes. Every time I try and submit my xml feed, I get the bad http result code: 404. However, the xml feed validates AND I can manually subscribe to it in itunes (File - Subscribe to Podcast). Any ideas as to why I get the bad http result code error?
Sorry all ... here is the feed: http://www.tullfinancial.com/managingTheWithdrawlPhase.xml
Thanks! -
Bad http result code: 500
trying to upload my podcast feed url for submission tothe itunes directory and i keep getting the following message
we had difficuluty reading this feed. Bad http result code: 500
here is the url
itpc://rss.mac.com/cjonesva/iWeb/wow/WOWPod/rss.xml
I'm a bit at a lossWhen you submitted your URL, did you submit http://rss.mac.com/cjonesva/iWeb/wow/WOWPod/rss.xml? This is the URL to your feed - the itpc://rss.mac.com/cjonesva/iWeb/wow/WOWPod/rss.xml URL is for giving people a one-click link that will subscribe them to your feed in iTunes.
Maybe you are looking for
-
How to copy playlists to new system? Have multiple IPODs on one computer..
I have recently upgrade the C drive on my system and did a clean install of Windows XP pro. In the process I have re-installed Itunes. The music itself (mp3 files..) is on a seperate hard drive. My problem is that I now have Itunes restored showing a
-
Multi gesture for browsers different from safari
Multi gesture for browsers different from safari, for example right to left scroll to previous page. How to set it like in Snow Leopard?
-
I have, a 2011 macbook pro with osx lion, last year it died, by doing the not getting past the logo and startup gear, i tried doing the data screen repair where u type some code and try and repair, that didnt work so i took it to genius bar and it w
-
Photoshop CS6 Stops Functioning Please Help
System Information Windows 8 x64 AOC 2243fW 1920x1080 monitor (x2) Processor: Intel Core i3 2120 3.40GHz (Dual Core) Ram: 6GB GPU: nVidia geForce GTX 760 TI 2GB DDR5 Notes: Photoshop is up to date. Performance settings in photoshop are set correctly.
-
Enhancment USEREXIT_PRICING_PREPARE_TKOMP
Hi all, I have a surcharge condition type ZS00 on the billing document, the condition type ZS00 has the key combination material(MATNR) and delivery priority(LPRIO), the surcharge will be maintained by material and delivery priority. I need deterimin