Not the rows returned by the spatial query wrapped in SELECT * FROM...
HelloWhen you run a query with SDO_EQUAL sub, I get a very strange behavior. The SDO_EQUAL query on its own works very well, but if I wrap in SELECT * from there, I get no results. If I wrap SDO_ANYINTERACT in SELECT * from there, I get the expected result.
It seems like the spatial index is used during the execution of the ordinary, but not when SDO_EQUAL request wrapped in SELECT * FROM. Weird. The spatial index is also not used when SDO_ANYINTERACT is wrapped in SELECT * FROM... so I don't know why that returns the correct answer.
I get this problem on 11.2.0.2 on Red Hat Linux 64-bit and 11.2.0.1 on Windows XP 32-bit (i.e., all versions of 11g I've tried). The query works as expected on 10.2.0.5 on Windows Server 2003 64-bit.
Any ideas?
Confused in Dublin (John)
Test case...
SQL>
SQL> -- Create a table and insert the same geometry twice
SQL> DROP TABLE sdo_equal_query_test;
Table dropped.
SQL> CREATE TABLE sdo_equal_query_test (
2 id NUMBER,
3 geometry SDO_GEOMETRY);
Table created.
SQL>
SQL> INSERT INTO sdo_equal_query_test VALUES (1,
2 SDO_GEOMETRY(3003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
3 SDO_ORDINATE_ARRAY(1057.39, 1048.23, 4, 1057.53, 1046.04, 4, 1057.67, 1043.94, 4, 1061.17, 1044.60, 5, 1060.95, 1046.49, 5, 1060.81, 1047.78, 5, 1057.39, 1048.23, 4)));
1 row created.
SQL>
SQL> INSERT INTO sdo_equal_query_test VALUES (2,
2 SDO_GEOMETRY(3003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
3 SDO_ORDINATE_ARRAY(1057.39, 1048.23, 4, 1057.53, 1046.04, 4, 1057.67, 1043.94, 4, 1061.17, 1044.60, 5, 1060.95, 1046.49, 5, 1060.81, 1047.78, 5, 1057.39, 1048.23, 4)));
1 row created.
SQL>
SQL> -- Setup metadata
SQL> DELETE FROM user_sdo_geom_metadata WHERE table_name = 'SDO_EQUAL_QUERY_TEST';
1 row deleted.
SQL> INSERT INTO user_sdo_geom_metadata VALUES ('SDO_EQUAL_QUERY_TEST','GEOMETRY',
2 SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 0, 100000, .0001), SDO_DIM_ELEMENT('Y', 0, 100000, .0001), SDO_DIM_ELEMENT('Z', -100, 4000, .0001))
3 ,81989);
1 row created.
SQL>
SQL> -- Create spatial index
SQL> DROP INDEX sdo_equal_query_test_spind;
DROP INDEX sdo_equal_query_test_spind
*
ERROR at line 1:
ORA-01418: specified index does not exist
SQL> CREATE INDEX sdo_equal_query_test_spind ON sdo_equal_query_test(geometry) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
Index created.
SQL>
SQL> -- Ensure data is valid
SQL> SELECT sdo_geom.validate_geometry_with_context(sdo_cs.make_2d(geometry), 0.0001) is_valid
2 FROM sdo_equal_query_test;
IS_VALID
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TRUE
TRUE
2 rows selected.
SQL>
SQL> -- Check query results using sdo_equal
SQL> SELECT b.id
2 FROM sdo_equal_query_test a, sdo_equal_query_test b
3 WHERE a.id = 1
4 AND b.id != a.id
5 AND sdo_equal(a.geometry, b.geometry) = 'TRUE';
ID
----------
2
1 row selected.
SQL>
SQL> -- Check query results using sdo_equal wrapped in SELECT * FROM
SQL> -- Results should be the same as above, but... no rows selected
SQL> SELECT * FROM (
2 SELECT b.id
3 FROM sdo_equal_query_test a, sdo_equal_query_test b
4 WHERE a.id = 1
5 AND b.id != a.id
6 AND sdo_equal(a.geometry, b.geometry) = 'TRUE'
7 );
no rows selected
SQL>
SQL> -- So that didn't work. Now try sdo_anyinteract... this works ok
SQL> SELECT * FROM (
2 SELECT b.id
3 FROM sdo_equal_query_test a, sdo_equal_query_test b
4 WHERE a.id = 1
5 AND b.id != a.id
6 AND sdo_anyinteract(a.geometry, b.geometry) = 'TRUE'
7 );
ID
----------
2
1 row selected.
SQL>
SQL> -- Now try a scalar query
SQL> SELECT * FROM (
2 SELECT b.id
3 FROM sdo_equal_query_test a, sdo_equal_query_test b
4 WHERE a.id = 1
5 AND b.id != a.id
6 );
ID
----------
2
1 row selected.
SQL> spool off
Here is the plan of the explain output for the query that works. Note that the spatial index is used.SQL> EXPLAIN PLAN FOR
2 SELECT b.id
3 FROM sdo_equal_query_test a, sdo_equal_query_test b
4 WHERE a.id = 1
5 AND b.id != a.id
6 AND sdo_equal(a.geometry, b.geometry) = 'TRUE';
Explained.
SQL> @?/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------
Plan hash value: 3529470109
------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 7684 | 3 (0)| 00:00:01 |
| 1 | RESULT CACHE | f5p63r46pbzty4sr45td1uv5g8 | | | | |
| 2 | NESTED LOOPS | | 1 | 7684 | 3 (0)| 00:00:01 |
|* 3 | TABLE ACCESS FULL | SDO_EQUAL_QUERY_TEST | 1 | 3836 | 3 (0)| 00:00:01 |
|* 4 | TABLE ACCESS BY INDEX ROWID| SDO_EQUAL_QUERY_TEST | 1 | 3848 | 3 (0)| 00:00:01 |
|* 5 | DOMAIN INDEX | SDO_EQUAL_QUERY_TEST_SPIND | | | 0 (0)| 00:00:01 |
------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - filter("B"."ID"!=1)
4 - filter("A"."ID"=1 AND "B"."ID"!="A"."ID")
5 - access("MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
..... other stuff .....
Here is the plan of the explain output for the query is not working. Note that the spatial index is not used.SQL> EXPLAIN PLAN FOR
2 SELECT * FROM (
3 SELECT b.id
4 FROM sdo_equal_query_test a, sdo_equal_query_test b
5 WHERE a.id = 1
6 AND b.id != a.id
7 AND sdo_equal(a.geometry, b.geometry) = 'TRUE'
8 );
Explained.
SQL> @?/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------
Plan hash value: 1024466006
--------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 7684 | 6 (0)| 00:00:01 |
| 1 | RESULT CACHE | 2sd35wrcw3jr411bcg3sz161f6 | | | | |
| 2 | NESTED LOOPS | | 1 | 7684 | 6 (0)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST | 1 | 3836 | 3 (0)| 00:00:01 |
|* 4 | TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST | 1 | 3848 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - filter("B"."ID"!=1)
4 - filter("A"."ID"=1 AND "B"."ID"!="A"."ID" AND
"MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
..... other stuff .....
Yes, this is the bug 9740355. You can get a 11.2.0.1 patch, or wait for 11.2.0.3.
Tags: Database
Similar Questions
-
How to get the inline query which is drawn from the TAB specific Application.
Hi all I use 10.2.0.4.0 oracle version.
I want to capture the sql that is raised in my prod database when an applicaton tab is hit as it takes about 5 minutes for the tab to be loaded. So is it possible, for the inline sql, which is the origin of the problem, directly from the prod environment.
(Note: I looked through the browser session in PROD DB for the query, but there, I found a lot of meetings and a lot of requests, I do not know how to distinguish the session being created by the specific tab I hit).>
Hello
I want to capture the sql that is triggered to my database of prod
When an applicaton tab is hit as it takes about 5 minutes so that the tab
to be loaded. So is it possible to get the inline sql, which is
the origin of the problem, directly from the prod environment.Please, please tell us that you have a Test environment? Log into that, then run a trace.
No doubt you can either descend all test for a few miinutes and/or
easily distinguish sessions on your Test System? That's exactly what the test
the environments are for.The SQL execution will be the same - you can go try to find
the root cause of the problem.HTH,
Paul...
-
Help, please! I've been rip CDs to the library and everything was fine. Then I put a cd in and I could hear this spin and charge but then... nothing. He said "not responding" in the taskbar above, next to windows media player.
I closed and reopened it. Different CD. Same thing. I restarted the computer. Once again, an another CD.but the same thing.
It plays all the songs that are in my library but when I'm in the "rip" tab, there is a message saying to start, "insert a CD into the CD drive. I do and as before, I can hear it spin and charge, but the window of windows media player does not recognize that there is a CD in the drive. In the upper right corner is corner it say 'disc (E)' is this a hardware problem or software? Please help me to solve it!http://support.Microsoft.com/GP/mats#tab2Has a troubleshooting guide automated for you.--..--"dee4156" wrote in message news: bc5b21d1-9fa9-48f9-a84a-eb439997ea79...> Please help! I've been rip CDs to the library and everything was fine.> Then I put a cd in and I could hear this spin and charge but then... nothing.> In the taskbar above, he said "no answer" next to windows media> player.> I closed and reopened it. Different CD. Same thing. I restarted the> computer. Once again, an another CD.but the same thing.> It plays all the songs that are in my library but when I'm in the "rip".> tab, there is a message saying to start, "insert a CD into the CD drive.> I do and as before, I can hear it spin and charge but windows support> the player window does not recognize that there is a CD in the drive. In the> top right corner, it says 'No disc (E)' is this a software or> hardware problem? Please help me to solve it! -
print the details of an individual selection from Windows Media Player
I would like information on how to print the contents of a list of individual reading of the Windows Media Player. I tried the exporter of information media, but it exports all my playlists. Is there a way I could pick only playlists that I need or one at a time?
Media Info exporter can export playlists too. To do this, click playlists in the sidebar left WMP, right click on the playlist you want to export and select send to - Media Info exporter . Tim Baets
http://www.BM-productions.TK -
We cannot use ORDER BY in the Sub query.
Get the below errorselect * from emp where emp_no in (select emp_id from dept order by dept_no )
ORA-00907: missing right parenthesis
Hello
user13024762 wrote:
To get the number of EMP table for maximum number of dept deptIf this is what you want, then do something like this:
select * from emp where emp_no in ( select MAX (emp_no) KEEP (DENSE_RANK LAST ORDER BY dept_no NULLS FIRST) from dept ) ;
or maybe
select * from emp where emp_no = ( select emp_no from dept where dept_no = ( SELECT MAX (dept_no) FROM dept ) ) ;
Depending on what you want in the case of a tie.
select * from emp where emp_no in (select emp_no from dept where rownum =1 order by dept_no desc)
The subquery that you posted above does not necessarily return the line containing the largest dept_no, since ROWNUM is affected before ORDER BY is done.
I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
Explain how you get these results from these data. -
Where is the result of the following query caching?
I run the following query statement:
Where is the result of the following query caching? Is cached in the PGA? What area of PGA?select * from hr.employees
By definition is not "cache". The blocks of data that are read to retrieve the results of the query are retrieved in the cache (DB_CACHE_SIZE or DB_BLOCK_BUFFERS component BMG) buffers so that they are accessible on several occasions by the same users or other users. However, because the buffer cache is limited in size, buffers are released when new blocks to be read. Buffers for a full table scan (as it would be for such a request) are released very probably earlier.
Please read the Oracle database documentation, starting with the Concepts manual for the version you are using. Starting at http://tahiti.oracle.com
Hemant K Collette
-
Adding the different values to a selection list?
4.2.1
Hello
I have three pages, home page that has to do with a filter period - values of the last 7 days last 14 days. Filter period is: P1_PERIOD
I have another page with the same report - last values 1 day, last 7 days, 30 days previous and last quarter. Filter period is: P2_PERIOD
Page two above shows the same reports based on the time period selected in the respective pages.
Now I have a third page that actually is a detail page that lists the details of the itemPage 1 Item last 7 days last 14 Days lights 10 16 Tail Lamp 2 10 Page 2 Item last 1 day last 7 days last 30 days last quarter lights 1 10 20 100 . .
The indictments to page 1 and page 2 hyperlinked.item_id item_name Item_Purchase_date 1 Lights 19-Mar-2013 1 Lights 16-Mar-2013 . .
My question is
1. on the page two: P2_PERIOD has the list of various selection options. so on page 3 I have an interactive report, when I run the query, I run it as
However, I also want to do the same on page 1. Or when the user presses the account on 7, 14 days, it will take them to the page three, but the same report should be run for 7 or 14 days based on what the user has selected in: P1_PERIOD.select * from item_master where item_purchase_date between decode(:P2_period,1, sysdate-1, 2, sysdate-7,3, sysdate-30, 4, sysdate-90) and sysdate.
Counsel on how to do it?select * from item_master where item_purchase_date between decode(:P1_period,1, sysdate-7, 2, sysdate-14) and sysdate.
Thank you
Ryanryansun wrote:
4.2.1Hello
I have three pages, home page that has to do with a filter period - values of the last 7 days last 14 days. Filter period is: P1_PERIOD
I have another page with the same report - last values 1 day, last 7 days, 30 days previous and last quarter. Filter period is: P2_PERIODPage two above shows the same reports based on the time period selected in the respective pages.
Page 1 Item last 7 days last 14 Days lights 10 16 Tail Lamp 2 10 Page 2 Item last 1 day last 7 days last 30 days last quarter lights 1 10 20 100 . .
Now I have a third page that actually is a detail page that lists the details of the item
item_id item_name Item_Purchase_date 1 Lights 19-Mar-2013 1 Lights 16-Mar-2013 . .
The indictments to page 1 and page 2 hyperlinked.
My question is
1. on the page two: P2_PERIOD has the list of various selection options. so on page 3 I have an interactive report, when I run the query, I run it as
select * from item_master where item_purchase_date between decode(:P2_period,1, sysdate-1, 2, sysdate-7,3, sysdate-30, 4, sysdate-90) and sysdate.
However, I also want to do the same on page 1. Or when the user presses the account on 7, 14 days, it will take them to the page three, but the same report should be run for 7 or 14 days based on what the user has selected in: P1_PERIOD.
select * from item_master where item_purchase_date between decode(:P1_period,1, sysdate-7, 2, sysdate-14) and sysdate.
Counsel on how to do it?
Take a different approach. Create a new P3_PERIOD_START item on page 3, calculate the date required on pages 1 and 2 and pass the value calculated on page 3 in the links (using a URL format secure as YYYYMMDD). Change the report query to
select * from item_master where item_purchase_date between to_date(:p3_period_start, 'YYYYMMDD') and sysdate
(Think about the implications of the use of Select * in production code.) Unwanted effects may occur if the definition of the table is changed.)
-
ORA-13226 executing spatial query to the poster
Hello
in my database, I have a vision with spatial column. The view is based on the UNION ALL select. When I try to run the spatial query on the view, the database returns error ora-13226. When I recreate the view consist an only select (without UNION ALL) the spatial query returns correct result. You might help me pls how a spatial query view space whose definition contains UNION ALL select?
Thank you
AndrewI don't know when this will be fixed by the Group of the optimizer, but there is a bug open about it: 8617254
Siva
-
Select from another table, when the query returns no result
Hello
I have a question where I'm supposed to retrieve the address of an account id-based billing. However, the table of billing may not have an address. There is a table of addresses that always has an address for an account. If the billing address exists, it should be used, so I can't use the address table. Is it possible in a select statement to query to the billing address and if it does not exist, use the address table.
SELECT * FROM accounts a, b billings WHERE a.accountid = b.accountid
Any help will be greatly appreciated.
Thank you.user10407139 wrote:
HelloI have a question where I'm supposed to retrieve the address of an account id-based billing. However, the table of billing may not have an address. There is a table of addresses that always has an address for an account. If the billing address exists, it should be used, so I can't use the address table. Is it possible in a select statement to query to the billing address and if it does not exist, use the address table.
SELECT * FROM accounts a, b billings WHERE a.accountid = b.accountid
Any help will be greatly appreciated.
I think you need to explain more clearly if
-you only have a couple of "billing" columns which is empty and in this case, you want to use the columns from the table 'accounts '.
- or you have a join with another table that doesn't return data, for example a foreign key "address_id" "billing" is zero and therefore the join to other tables 'address' will return all the data
In the first case, you have already been provided with some examples here, how to use NVL or similar functions to achieve, even if the first post first evaluates the information of 'accounts' and if it is white using information from "billing". According to your description you need the other way around. The second post a subquery recursive useless in my opinion.
In the latter case, you should probably use an "outer" join so that the data in your table "bills" are returned, even if the join to another table is not at all the lines.
SELECT NVL(AD1.ADDRESS_ATTR1, AD2.ADDRESS_ATTR1) as ADDRESS_ATTR1, NVL(AD1.ADDRESS_ATTR2, AD2.ADDRESS_ATTR2) as ADDRESS_ATTR2, NVL(AD1.ADDRESS_STREET, AD2.ADDRESS_STREET) as ADDRESS_STREET, ... FROM accounts a INNER JOIN billings b ON a.accountid = b.accountid LEFT OUTER JOIN address ad1 ON b.address_id = ad1.address_id INNER JOIN address ad2 ON a.address_id = ad2.address_id;
In this way you pick up the address stored in the "invoices" table, if it existed, otherwise you pick up the address assigned to the "accounts" table I used an inner for the second address join join because you said that the account always has an assigned address.
Kind regards
RandolfOracle related blog stuff:
http://Oracle-Randolf.blogspot.com/SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676 /.
http://sourceforge.NET/projects/SQLT-pp/ -
Table error ' can not analyze the SQL query!
Hi all
I created a view on my database called VIEW_MEMBER_PARTIC_PROJECTS
If I run a query showing the results of the view:
SELECT * FROM VIEW_MEMBER_PARTIC_PROJECTS
I get the following data
Projects Participants 1 31 S 2 41 3 19 4 3 5 3 6 1 7 2 Now, I wanted to represent this diagram in the APEX so I created a graphic region and entered the Source query generator and the manufacturer produces the following code
Select null, label projects, value1 Participant link
of "SCHEMANAME." "" VIEW_MEMBER_PARTIC_PROJECTS ".
With this code, I get an error:
Cannot parse the SQL query!
Select the link null, label projects, value1 "SCHEMANAME Participant." "" VIEW_MEMBER_PARTIC_PROJECTS ".
Some queries can be run when you run your application, if your query is syntactically correct, you can save your query without validation (see options below the source of the query).
The code looks OK, but I do not see to save options as the error code is mentioned.
No one knows how to fix this?
Thank you
JaReg wrote:
I finally found the problem.
I looked at the code for the view and changed the start of:
CREATE OR REPLACE FORCE EDITIONABLE VIEW "SCHEMANAME." "" VIEW_MEMBER_PARTIC_PROJECTS "("Participant","Projects")
AS
TO
CREATE OR REPLACE VIEW "SCHEMANAME." "" VIEW_REPEAT_PARATIC ".
AS
And that seemed to fix it. I'm not entirely sure why though.
The view was created using the quoted identifiers for column names. This makes them sensitive and means that they must always be referenced using double quotes. In the absence of quotation marks, Oracle is not case insensitive and automatically converts all uppercase identifiers. The application of graph:
Select the link null, label projects, value1 "SCHEMANAME Participant." "" VIEW_MEMBER_PARTIC_PROJECTS ".
has therefore been interpreted by Oracle:
SELECT THE LINK NULL, LABEL, VALUE1 "SCHEMANAME PARTICIPANT PROJECTS." "" VIEW_MEMBER_PARTIC_PROJECTS ".
and PROJECTS and PARTICIPANT columns were not recognized because the columns defined for the view have been 'Participant' and 'projects '. The graphic request should have been:
Select the link null, the label of "Projects", "Participant" value1 "SCHEMANAME." "" VIEW_MEMBER_PARTIC_PROJECTS ".
As you have now discovered, quoted identifiers are a source of nothing but obscure bugs and should never be used for database objects. He also pointed out the reason why you should always use a standardized, form tiny, coding style as it is faster to type, easy to read and less prone to errors.
-
Adding a user to a role, you see only not the role permissions
Hi all
Simple question HERE and frustrating because it seems so easy... Oracle 11 G 64-bit (11.2.0.3) on Windows
I created a role and a user as follows:
CREATE USER TEST_USER IDENTIFIED BY <password> DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE M_TEMP PROFILE DEFAULT ACCOUNT UNLOCK; -- 1 Role for TEST_USER GRANT INTELLIWAVE TO TEST_USER; ALTER USER TEST_USER DEFAULT ROLE NONE; -- 1 System Privilege for TEST_USER GRANT CREATE SESSION TO TEST_USER;
The role is:
CREATE ROLE INTELLIWAVE NOT IDENTIFIED; -- Object privileges granted to INTELLIWAVE GRANT SELECT ON SCHEMA1.ERROR_LOG TO INTELLIWAVE; -- Grantees of INTELLIWAVE GRANT INTELLIWAVE TO TEST_USER; GRANT INTELLIWAVE TO SYS WITH ADMIN OPTION;
Now when I use the Toad and sign in using the TEST_USER user, I can connect fine but if I try to choose among this SCHEMA1. Table ERROR_LOG, reads table/view does not exist. And when I check the tree of the scheme under the scheme, I don't see this table under that user. It is there.
What Miss me?
Thanks in advance!
It seems likely that the new role is not enabled in the session. Try
SELECT * FROM SESSION_ROLES;
While signed in as a user. The new role appears?
I don't see EDIT USER by DEFAULT ALL ROLE; in your script CREATE USER.
I don't see EDIT USER by DEFAULT ROLE INTELLIWAVE;
For example, if the role is not one of the default roles for the user (via one of the above) then you will need to deliver the VALUE ROLE INTELLIWAVE. or the ROLE ALL VALUE; to access privileges granted to this role. The SET ROLE command affects only the current session.
-
generations of months using the sql query
Hello
Based on the input of date parameter, I need display every month in the current year and last year.
For example, suppose that my setting date is December 5, 14 ', I need the output below.
JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER
JANUARY
FEBRUARY
MARCH
APRIL
PEUT
Until the month of May and the month last year. I came with the request. Please find the following query.
Select to_char (add_months (trunc(sysdate,'year'), level-1), 'MONTH') mth
of the double
connect by level < = 12
Union of all the
Select to_char (to_date (ddate, 'MM'), 'MONTH') month
(select 1 + rownum - 1 ddate
from user_objects
where (1 + rownum - 1) < = to_number (to_char (to_date ('12-05-14', ' dd-mm-yy'), 'mm')));
But I don't want to use the data user_objects dictionary. Can you please guide how to achieve this output, or can u give me some other request too if possible.
Thank you
Siva
Try the below
SELECT TO_CHAR (ADD_MONTHS (ADD_MONTHS (TRUNC (TO_DATE(:date1,'DD-MM-YY'), 'MM'),
((- MONTHS_BETWEEN (trunc (to_date(:date1,'DD-mm-YY'), 'MM'), trunc (to_date(:date1,'DD-mm-YY'), 'YY')) + 12)).
(LEVEL-1))
, 'MONTHS '.
'NLS_DATE_LANGUAGE = ENGLISH') FROM dual months_between
CONNECT BY LEVEL<=>=>
-
Tables of contents, not the substitution of character styles applied in chapters
My table of contents uses not the style of input I select words in the paragraphs that have styles of characters that are applied in the chapter, so some letters, more precisely the parameters, displayed in green, which is well in the chapter but not in the table of contents. I can manually fix this in the table of contents by changing the character to any style after the table of contents was generated, but I don't want to do that. I think it has to happen automatically.
This should do it:
(?<=\()[\w, \w)]*(?="">=\()[\w,>
It searches the text in parentheses without selecting them.
-
Execution of the SQL query through 2 different databases to Oracle
Hi all
In Microsoft SQL server, we can run on 2 different databases depending on the type of SQL query:
Select * from TEST1.dbo.GENERIC_TABLE1 union select * from TEST2.dbo.GENERIC_TABLE2;
Test1 and TEST2 here is 2 different databases.
Can we do the same in Oracle?Of course you can do it.
Create a [database join | http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_5005.htm] from DB1 to DB2.Grant select on the tables of the DB2 schema with which you want to connect.
And then, you can you can query as
select * from DB1schema.emp union select * from emp@dblink_name;
-
Need to understand the features of LEVEL when printing from 1 to 100
Can someone please explain to me how the following query?
SELECT LEVEL just_a_column
OF the double
CONNECT BY LEVEL < = 365
I tried to understand Oracle generator line Techniques - Oracle FAQ , but I did not understand much.
Hello
ORA - aff wrote:
Thanks Frank. I appreciate your response.
Can you please explain more about how "CONNECT LEVEL <=>=> works in this query?"
I understand when it is "CONNECT BY PRIOR emp_id = mgr_id" - for a current line it's going to go and find a row in the table employees whose Manager id is equal to the employee id for the previous line.
Good! You already understand the most difficult part.
In this case, CONNECT BY condition is
Emp_id PRIOR = mgr_id
This condition uses emp_id PREREQUISITE, which means that, when deciding if a line will join the game at the level of results = n, he's looking to see what the emp_ids are on LEVEL =(n-1).
A line will join the LEVEL = 2 if its mgr_id is identical to a level 1 = emp_id.
A line will join the LEVEL = 3 if its mgr_id is identical to a level 2 = emp_id
A line will join the LEVEL = 4 if its mgr_id is identical to a level 3 = emp_id.
...
and so on, until you reach a LEVEL where no line do not join.
But I don't understand "CONNECT LEVEL <=>=> ?"
In this case, CONNECT BY condition is just
LEVEL<=>=>
PRIOR is not used in this condition, which means that, when deciding if a line will join the game at the level of results = n, it is not all knowledge on what is on LEVEL =(n-1).
A line will join the LEVEL = 2 if 2<=>=>
A line will join the LEVEL = 3 if 3<=>=>
A line will join the LEVEL = 4 If 4<=>=>
...
and so on, until you reach a LEVEL where no line do not join (which will be LEVEL = 366).
Maybe you are looking for
-
I have a Macbook Pro for mid-2010 running 10.6.8 Snow Leopard since it's purchase. I wiped it clean last summer (2015) and reinstalled Snow Leopard and did a cleanup of the House. With Safari is no longer supported, I used Chrome and Firefox until
-
Re: update the Bios Z830 Satellite: "this computer is not supported.
Hello I replaced the Windows preinstalled with an installation of Fedora 16, - which works perfectly btw - and hopeto solve the "Windows only Bios update problem" with a Windows 7 bootable USB drive, which works againgreat so far, but the BIOS160_EC1
-
How to re - add my phone number to my apple ID so that I can send imessages?
My iphone has deleted my phone number of my apple ID, and I can't link it.my email address is attached, but it will not send or receive messages either. I tried to connect from my apple account and when I try to turn my imessage, it comes up with the
-
How do I detect when a write of correlated digital output is completed
Hi LabGurus I'm trying to synthesize a SPI signal on the output lines digital stamped usin a M - Series USB Daq (6225, 6229). I wrote most of the code and have developed the following problems: When I use 'finished samples' to the clock mode, the wav
-
I will be buying leather, and I downloaded a blank form of them and put in paint. But when I try to color, each color comes out like gray. My painting is broken, because when I just paint on a white sheet colours are normal. How can I fix?