Number of tables in the from clause
HelloCan someone tell me how many tables can we have clause in oracle.
As you can see it
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14237/limits003.htm#i288032
Subqueries levels Maximum of subqueries in a unlimited SQL in the FROM clause in subqueries queries Top Level 255 in the WHERE clause
Subqueries in the FROM-> unlimited, so number of tables is also unlimited (limited only by the size of SQL and probably time of your life while waiting to join thousands of tables :)) results
Tags: Database
Similar Questions
-
Effect of an additional table in the FROM clause in the query results?
I recently helped a colleague debug one of their SQL statements
The output was showing some very unexpected totals, and I was able to shrink down to an additional table in the FROM clause, but not used anywhere else in the application.
Thus, for example
SELECT A.ID, B.CODE
Of
EMPLOYEE,
B OF THE STATUTE,
PAY THE SAL
WHERE A.ID = B.ID
AND
A.ID = 1;
I was wondering, how can an extra table in a FROM clause influence directly on the rest of the query?
The query above is just an example of what I've seen, the my co worker was working on is a bit larger and a lot more code to read. I noticed that when I added/removed the extra table in my query to co workers and then it worked as expected.
I always thought that an additional table is not attached to what anyone would be just to do the inefficient code, but does not affect outputjust do the inefficient code
Yes, that too, you will get a Cartesian product by calling is not the entries in the where clause for this table 'disappeared' :(
-
Results of the query variant with unused table in the from clause
Hi all
I (processing_table2) table specified in the FROM clause in the SQL query , but I have not used any of its value in the SQL statement , but it still affects the results of the query. Please help me out here I'm naïve.
This is the provided query
SELECT SUM((CREV.sadc_extd*CSSP.redit_pcnt)/100)
OF crev revenue_lines,.
cssp sales_split,
processing_table2
WHERE crev.order_num = '7631090072'
Results of the above query : 344028065018.359
SELECT
Sum((CREV.sadc_extd*CSSP.redit_pcnt)/100)
OF crev revenue_lines,.
sales_split PCSS
WHERE crev.order_num = '7631090072'
Results of the above query : 26463697309.1046
Someone here suggest me pls!924804 wrote:
Hi allI (processing_table2) table specified in the FROM clause in the SQL query , but I have not used any of its value in the SQL statement , but it still affects the results of the query. Please help me out here I'm naïve.
This is the provided query
SELECT SUM((CREV.sadc_extd*CSSP.redit_pcnt)/100)
OF crev revenue_lines,.
cssp sales_split,
processing_table2
WHERE crev.order_num = '7631090072'Results of the above query : 344028065018.359
SELECT
Sum((CREV.sadc_extd*CSSP.redit_pcnt)/100)
OF crev revenue_lines,.
sales_split PCSSWHERE crev.order_num = '7631090072'
Results of the above query : 26463697309.1046
Someone here suggest me pls!
CARTESIAN PRODUCT of the changes result set
-
Two variables in the name of a table in the FROM clause.
Hello
I have a problem to make this work:
SELECT *.
OF tablename_YY_MM
(This is part of the script I use YY and MM in different tables)
I need to find a way for the script asks me every time on AA and the MM
For example, the current name of the table "tablename_09_08" next month, it will be 'tablename_09_09 '.
It seems simple, but I can't get it to work. There seems to be a problem with concatenate | and the underscore _
Looks like this should be done with PL/SQL?
If anyone can help it will be much appreciated.
Thank you.
Published by: user1067236 on August 11, 2009 02:21
Published by: user1067236 on August 11, 2009 02:23SQL>SELECT * FROM tablename_&YY._&MM; Enter value for yy: 09 Enter value for mm: 08 old 1: SELECT * FROM tablename_&YY._&MM new 1: SELECT * FROM tablename_09_08 SELECT * FROM tablename_09_08
HTH, Urs
-
Question on the use of expressions and aliases in the FROM clause
Hello
I have the following query
outputs (of your choice):select substr(e.ename, iter.pos, 1) as C from (select 'KING' as ename from dual) e, (select rownum as pos from dictionary where rownum <= 100) iter where iter.pos <= length(e.ename);
For the purposes of hardcode 'KING' was made for the test, IRL would be a column from other tables. Is the other piece that is hardcoded "where rownum < = 100 ' and it's the one I would like to find a way to remove.C - K I N G
I tried the following:
Unfortunately this does not work because the SQL parser has not analyzed enough of the FROM clause to know e.ename causing the length (e.ename) expression return a message identifier unknown.select substr(e.ename, iter.pos, 1) as C from (select 'KING' as ename from dual) e, (select rownum as pos from dictionary where rownum <= length(e.ename)) iter where iter.pos <= length(e.ename);
I tried to restructure the query above to make the SQL parser aware of the e.ename early enough and therefore accept it. My efforts have failed.
I would like to know if there is a way to restructure the statement length (e.ename) can be used instead of Hardcoding an artificial upper limit (for example 100 as in the first statement).
Thank you
John.Use CONNECT BY LEVEL:
SQL> select substr(ename, level, 1) 2 from ( select 'KING' ename 3 from dual 4 ) 5 connect by level <= length(ename); S - K I N G 4 rows selected.
-
Pass Pl/sql table in the USING clause in the EXECUTE IMMEDIATE statement
Getting error when I try to pass the PL/SQL table in the USING clause in the EXECUTE IMMEDIATE statement:
Declare
result NUMBER;
TYPE values_tab IS TABLE OF NUMBER INDEX OF directory;
lv_tab values_tab;
lv_exp varchar2 (300);
lv_exec varchar2 (300);
BEGIN
lv_tab (1): = 5;
lv_tab (2): = 48;
lv_tab (3): = 7;
lv_tab (4): = 6;
lv_exp: = ': + b1: b2 + (: b3 *: b4)';
lv_exec: = 'SELECT'. lv_exp | ' THE DOUBLE '.
IMMEDIATE EXECUTION
lv_exec
IN
result
USING
lv_tab;
DBMS_OUTPUT. Put_line (result);
END;
/
Error on line 1
ORA-06550: line 20, column 12:
PLS-00457: expressions must be SQL types
ORA-06550: line 15, column 8:
PL/SQL: Statement ignored
I am trying to evaluate the expression ': + b1: b2 + (: b3 *: b4) "which is stored in the table. This table has different expressions (expressions about 300). I want to use the bind variable in the expression because each expression evaluated thousands of time may be more in some cases. If I use bind variable can he fill pool.
Is there a way I can pass parameters with the HELP of (IN) dynamically instead of write "help lv_tab (1), lv_tab (2), lv_tab (3), lv_tab (4)? As number of change of the input parameters depend on the expression in the table.
If it is possible please suggest any other ideas/approaches
Help, please...
Published by: satnam on June 11, 2009 11:50Well, you keep changing faster reqs that I can follow. In any case, assuming that N-th variable bind (left to right) corresponds to n-th collection item:
Declare result NUMBER; lv_tab values_tab := values_tab(); lv_exp varchar2(300); lv_exec varchar2(300); lv_i number := 0; BEGIN lv_tab.extend(4); lv_tab(1) := 5; lv_tab(2) := 48; lv_tab(3) := 7; lv_tab(4) := 6; lv_exp := ':5000135+:5403456+(:5900111*:5200456)'; lv_exec := lv_exp; While regexp_like(lv_exec,':\d+') loop lv_i := lv_i + 1; lv_exec := REGEXP_REPLACE(lv_exec,':\d+',':b(' || lv_i || ')',1,1); end loop; lv_exec := 'BEGIN :a := ' || lv_exec || '; END;'; DBMS_OUTPUT.PUT_LINE(lv_exec); EXECUTE IMMEDIATE lv_exec USING OUT result,IN lv_tab; DBMS_OUTPUT.PUT_LINE(result); END; / BEGIN :a := :b(1)+:b(2)+(:b(3)*:b(4)); END; 95 PL/SQL procedure successfully completed. SQL>
SY.
-
How can I model the RPD with the sub query that has the subquery in the from Clause.
SELECT
o948938. CONSOLIDATED_NAME,
(SUM (o948992. YTD_COMPLETED)) / (SUM (TOTAL_OCC_AP)) AS C_1,.
SUM (TOTAL_OCC_AP) AS TOTAL_OCC_AP,
Of
ORG_DIM o948938,
TIME_MONTHLY_DIM o948963,
INSPECTION_FACT o948992,
(SELECT TDS_NUM,
MONTH_ID,
SUM (TOTAL_APTS) TOTAL_AP,
OF SUMMARY_FACT
TDS_NUM GROUP,
MONTH_ID
) O949126
WHERE (o949126. MONTH_ID = o948992. MONTH_ID (+)
AND o949126. TDS_NUM = o948992. TDS_NUM (+)
AND (o948938. TDS_NUM = o949126. TDS_NUM)
AND (O948963. MONTH_ID = O949126. MONTH_ID))
Group
O948938. NEW_BOROUGH_GROUPING
Hello
You can do this via an opaque view.
You can also do this by modeling the cumulative value as a calculation LOGIC in the group by aggregation "pinned" to a specific dimension hierarchy that reflects consolidation in the online posting.
Hope this helps,
Robert.
-
* Dynamic * Table name in the From Clause, with the help of the cursor
Hello
I said a slider...
Select the table table_name from dba_tables where < blah >
The result is
Row1: emp
rwo2: emp_1-> tables have the same structure and quite different data... Please don't ask why it's like that, and we can not change...
Now, we need to run an Insert...
Insert into tableX (col1, col2,...) select a, b,... from < o/p of the cursor > where < blah >...
Note: The table changes name and it the cursor can o/p emp, emp_a and emp_b.
Trying to do at the same time instead of do series and with the best performance... .no sql injection issues.
In parallel, I mean
Insert into tableX (col1, col2,...) select a, b,... from emp where < blah >
and insert tableX (col1, col2,...) select a, b,... from emp_1 where of < blah > statements at the fire parallel / at the same time to the database. If you can share the procedure if you guys already have with you... is really appreciated
Thank you very much for your time...
Published by: user007009 on April 27, 2013 20:33>
because suppose each request took 10 minutes and we have 5 tables, then 50 minutes so executed in series and 5 minutes, if each of them both right... I'm saving this time
>
And that's what I'm talking about when I said that
>
what you're doing wrong is trying to implement solutions more possible complex for a problem that does not exist yet.
>
You do not HAVE a problem. You are just "assuming"; "Suppose that each query took 10 minutes... ».Well suppose that the time it takes to "chunk" the query, run it in parallel is longer than the time it takes to simply run the query. Oh, wait, that OF what you have discovered.
Well, let's assume that each query took 2 seconds. Assume that all this takes that half a second. Suppose you waited until you actually have a problem.
The solutions are to solve real problems, not imaginary and non-existent problems.
If all you are doing is "assume that" you will never find a 'solution' because you could always 'suppose' another problem that prevents this 'solution' of work.
-
Try adding conditions to clause "and" stored in the table for the where clause, unknown syntax
I am trying to add additional segments to the 'where' clause, and I don't know exactly how to proceed. I am currently using another table to search for keywords and sometimes there aren't everything. I use this table containing the key words to search the description and associate a symbol with a path.
The code loops through the keywords with the keywords most associated and try to find links to a symbol then excludes those and search for symbols that correspond to those with less keywords and all. I am able to do this with 6 queries and manually changing the arguments, but I want to loop together so that if the changes need to be made in the future, I won't need to go digging in the code.
Thanks, but that's ok. I already have a solution for this.
-
Drop a large number of tables with the same prefix
Hello
can you help me to make a script to move all the tables with the same prefix = TEST_LINK_?
Thank you very much.
CrystalHi crystal,
Here's something to start. It does not all FK constraints on those tables and assumes that the executor is the owner.
declare pstmt constant varchar2(255) := 'drop table :t purge'; vstmt varchar2(255); begin for rec in (select table_name from user_tables where table_name like 'TEST_LINK\_%' escape '\') loop vstmt := replace(pstmt, ':t', rec.table_name); dbms_output.put_line(vstmt || ';'); -- execute immediate vstmt; end loop; end; /
Concerning
Peter -
How to put the subquery in the from clause
Hi all
I want to put a my from clause subquery. I want to show the details of an account, when the status is active, but I want to show the date when he opened.
Here is my report query.
Select t.acct_id, x.acct_status_Dt
of cust_acct t, (select t1.acct_id, t1.acct_status_Dt from t1 cust_acct where t1.acct_status_code = 'OPEN') x
where t.acct_id = x.acct_td
and t.acct_status_code = 'ACTIVE'
Someone knows how to impliment this kind of query in OBIEE without RPD Exchange.
Help, please...Hello
To be more clear, ask in the Advanced tab of the request, should look like:
select A.saw_0, x.saw_1 from (select acct_id saw_0 from cust_acct)A, (select acct_id saw_0, acct_status_Dt saw_1 from cust_acct where cust_acct.acct_status_code='OPEN') x where a.saw_0=x.saw_0
Actual query that you pasted:
select t.acct_id,x.acct_status_Dt from cust_acct t , (select t1.acct_id, t1.acct_status_Dt from cust_acct t1 where t1.acct_status_code='OPEN') x where t.acct_id= x.acct_td and t.acct_status_code='ACTIVE'
I think it is x.acct_id in where clause... not x.acct_td, I corrected and wrote the sql above...
Published by: Kishore Guggilla, July 17, 2009 12:00
-
NUMBERS FROM 1 TO 300 WITH THE HELP OF THE TABLE 'DOUBLE' IN FROM CLAUSE
Hi masters.
I need display numbers from 1 to 300.
We can achieve this by
Select rownum from TABLE_NAME where ROWNUM < = 300;
But the need to display table DOUBLE...Try this:
SELECT the level "Numbers."
OF the double
CONNECT BY LEVEL<=>=> -
#OWNER # in FROM clause
I currently use APEX 4.2 to create traditional and interactive reports. I noticed that in the FROM clause
generated by the wizard #OWNER # is included in addition to the explicitly specified table in the
creating reports. Why is this it is included? Is it necessary? The application seems to work even when I
manually delete #OWNER # in the list.
I found a few discussions that suggest that this is potentially a security problem and that it is better
convenient to use only the tables in the FROM clause. Is this true?
Thank you.
Hello
You can remove it from the query, it will not make a real difference. It is very likely that in a future version of the TOP wizards add it more.
Concerning
Patrick
Member of the APEX development team
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf
-
Mark from a table where the column value is a colon-delimited list
Version: Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
Hello
This is a new query of a query Frank helped me with:
Demand is all users to restrict the report based on a multiple selection on the front-end server (application APEX) filter.
The filter returns that a colon-delimited list and the data in the table can be saved in a delimited by a colon list too. There may be 1 to n values (up to 4000 characters).
I need a WHERE clause that will allow a match, if it exists, between the data in the column of the Table and the Mult-selection list filter.
The abbreviated for this post query would be something like:
SELECT slt_id, slt_item, slt_owner
OF slt_dashboard
WHERE slt_owner IN (colon delimited page list);
The Create Table and Insert statements:
CREATE TABLE slt_dashboard ( dashboard_id NUMBER, slt_id VARCHAR2(10), slt_item VARCHAR2(2500), slt_owner VARCHAR2(4000), slt_type VARCHAR2(25), slt_year NUMBER, parent_id NUMBER ); --Insert slt_dashboard INSERT INTO slt_dashboard(dashboard_id,slt_id,slt_item,slt_owner,slt_type,slt_year,parent_id) VALUES (12,'1.1','Implement revenue enhancement initiatives','E15889:JPARISI:BDUR63','Business Commitment',2014,6); INSERT INTO slt_dashboard(dashboard_id,slt_id,slt_item,slt_owner,slt_type,slt_year,parent_id) VALUES (13,'1.2','Strengthen our Energy position','KVROMAN','Business Commitment',2014,6);
I have a function to separate the list delimited by two points in a table for the IN clause, but because these values can be saved in a delimited list of Colon in the column of the Table, I have a problem, being able to analyze the data in the column, AND the filter data.
The function is:
CREATE OR REPLACE FUNCTION get_list( p_string IN VARCHAR2 ,p_delimiter IN VARCHAR2 DEFAULT ':' ) RETURN vc_array_1 PIPELINED IS l_string VARCHAR2( 32000 ); l_array wwv_flow_global.vc_arr2; BEGIN l_array := APEX_UTIL.string_to_table( p_string ,p_delimiter ); FOR i IN l_array.FIRST .. l_array.LAST LOOP PIPE ROW ( TRIM( l_array( i ) ) ); END LOOP; RETURN; END;
The function called in the query in the form (it's just for reference in case someone wanted to know):
SELECT ... FROM ... WHERE slt_owner IN (SELECT * FROM TABLE( get_list( :P115_SLT_OWNER ) ));
But I can't use this approach because the data in the Table can be saved in a delimited list of Colon too.
Desired output:
If the Mult-Select list filter contains: E15889:JPARISI then
1.1 implementation of the E15889 revenue improvement initiatives; JPARISI (it's a semicolon between the names)
If the multiple-selection list filter contains: KVROMAN then
1.2 strengthen our position of energy KVROMAN
If the multiple-selection list filter contains: BDUR63:KVROMAN then
1.1 implementation of the BDUR63 revenue improvement initiatives
1.2 strengthen our position of energy KVROMAN
Please let me know if something is not clear.
Thank you
Joe
I went to approach the Table and the Page works perfectly.
Thank you to everyone!
Thank you
Joe
-
Error in FROM clause (MS Access)
I am getting an "error running a database query." The query is a simple
< name cfquery = "myquery" datasource = "#application.dsn #" >
SELECT *.
OF #url.table #.
< / cfquery >
The debugging info I get is the following:
SELECT * COMMAND
VENDORERRORCODE-3506
SQLSTATE 42000
It also indicates the error is in the FROM clause and only happens when url.table is stopped, not other names of tables. I know that the order table exist because I get an error of table name that does not exist when the url table is a false table name. This implies that
He knows the order table exist but said that there is a mistake in the FROM clause. The query is successful on all other tables in my db (MS access, I use the access without unicode driver). Any ideas?the order is a keyword, you will need to avoid using brackets
[ORDER]
HTH
--
Tim Carley
www.recfusion.com
[email protected]
Maybe you are looking for
-
I don't see listed 10. I guess that there is a parameter that could be changed, to wear this.
-
Tunnel VPN Firewall (both sides of the Site B, same IP series)
Hi Experts, I'm in a weird situation, hope I can get an answer from you guys. I had created VPN tunnel to our customer on our firewall 3 years. Now we create the VPN tunnel for new customer, but the IP settings to the new customer is the same as the
-
Receiver from Onkyo TX-8050 network not found in the list of media broadcast
I just bought an Onkyo TX-8050 network receiver and want to listen to music via WMP 12 in Windows 7. I turned on the streaming and the "Allow remote control" and "Automatically allow devices to read my media" is checked. However, the receiver cannot
-
Hey all thanks for reading my post. Can someone tell me or point me to a doc that says 100% certainty what updates regarding IP addresses are disruptive. IE: Signatures, engine, software. Thank you guys for your help. Rodney Sent by Cisco Support tec
-
Impossible to get the handle to the current row in a table
Hi Experts,I am facing a problem all of a sudden.My page has a table of data, which has an (image) column, updated image. I can't pass the parameter as the vo is not the headerid of the column on the page, but it is made wrong.That's why I can't use