Selecting data from Multiple Partitions in a single select stmt.
Hi all,
My Database is very large & my tables are partitioned.
My question is:
1) If my data is spread across multiple partitions, is there any way to select data from multiple partitions in a single query?
If we dont mention partition name also it works fine, but perofmance wise it will be very slow. (Using EXPLAIN PLAN)
(Note:I dont want to make use of Union concept, i want to do it in a single select statement)
For ex:
qry1.sql:
select empno from emp_trans partition (P012000)
This above query(qry1.sql) will work fine.
qry2.sql:
select empno from emp_trans partition (P012000,P022000)
The above query(qry2.sql) will return will return the following error:
ORA-00933: SQL command not properly ended
If anybody has any solution for this, pls mail me immediately.
Thanks in advance
bye
null
All my queries are dynamically generated. All my tables are also indexed partition wise based on date field. My question is, if i want to mention multiple partition names at the time of generating my query(select), then with parformance will be good. I have refered some books, inthat what they say is to use UNION concept, i dont want to use that, instead i want in a single select statement.
Thaks for ur reply
Bye
null
Similar Messages
-
Move data from multiple Tables to a Single Table & Convert the list to ALV.
Hi,
My aim is to get the list of Materials with their descriptions, with MRP Controller, with Unrestriced Qty. & the Reorder Qty. So, I have to fetch the data from different tables. But finally I am not able to copy or move the fetched data from multiple tables into the single final table.
Also tell me how to convert this list into ALV.
Below is the program code.
*& Report Y_REORDER_REPORT
REPORT Y_REORDER_REPORT.
tables : marc,makt, mard.
DATA: Begin of i_final occurs 0,
matnr type marc-matnr,
maktx type makt-maktx,
DISPO type marc-DISPO,
MINBE type marc-MINBE,
LABST type mard-LABST,
end of i_final.
DATA: Begin of i_marc occurs 0,
matnr type marc-matnr,
DISPO type marc-DISPO,
MINBE type marc-MINBE,
end of i_marc.
DATA: Begin of i_makt occurs 0,
matnr type makt-matnr,
maktx type makt-maktx,
end of i_makt.
DATA: Begin of i_mard occurs 0,
matnr type mard-matnr,
LABST type mard-LABST,
LGORT TYPE MARD-LGORT,
end of i_mard.
SELECT matnr
dispo
minbe from marc
into corresponding fields of table i_marc
where dispo EQ 'STR'.
SORT I_MARC by MATNR.
WRITE: /10 'Material',
75 'MRP',
80 'Reorder Qty.'.
LOOP at i_marc.
Write: /10 i_marc-matnr,
75 i_marc-dispo,
80 i_marc-minbe.
ENDLOOP.
write: /.
SELECT matnr
MAKTX from makt
into corresponding fields of table i_makt
for all entries in i_marc
where matnr = i_marc-matnr.
LOOP at i_makt.
Write: /10 i_makt-matnr,
30 i_makt-maktx.
ENDLOOP.
SELECT matnr
LGORT
LABST from mard
into corresponding fields of table i_mard
for all entries in i_marc
where matnr = i_marc-matnr.
LOOP at i_mard.
Write: /10 i_mard-matnr,
30 I_MARD-LGORT,
40 i_mard-labst.
ENDLOOP.
move i_mard-matnr to i_final-matnr.
move i_marc-dispo to i_final-dispo.
move i_marc-minbe to i_final-minbe.
move i_makt-maktx to i_final-maktx.
move i_mard-labst to i_final-labst.
WRITE: /10 'Material',
30 'Material Desc.',
75 'MRP',
80 'Reorder Qty.',
105 'Current Stock'.
LOOP at i_final.
Write: /10 i_final-matnr,
30 i_final-maktx,
75 i_final-dispo,
80 i_final-minbe,
105 i_final-labst.
ENDLOOP.
*LOOP at i_mard.
*Write: /10 i_mard-matnr,
30 i_makt-maktx,
75 i_marc-dispo,
80 i_marc-minbe,
105 i_mard-labst.
*ENDLOOP.
Regards,
VishalChange like this,
SELECT matnr
lgort
labst FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_mard
FOR ALL ENTRIES IN i_marc
WHERE matnr = i_marc-matnr.
LOOP AT i_mard.
WRITE: /10 i_mard-matnr,
30 i_mard-lgort,
40 i_mard-labst.
ENDLOOP.
LOOP AT i_marc.
READ TABLE i_mard WITH KEY matnr = i_marc-matnr.
READ TABLE i_makt WITH KEY matnr = i_marc-matnr.
MOVE i_mard-matnr TO i_final-matnr.
MOVE i_marc-dispo TO i_final-dispo.
MOVE i_marc-minbe TO i_final-minbe.
MOVE i_makt-maktx TO i_final-maktx.
MOVE i_mard-labst TO i_final-labst.
APPEND i_final.
ENDLOOP.
WRITE: /10 'Material',
30 'Material Desc.',
75 'MRP',
80 'Reorder Qty.',
105 'Current Stock'. -
Displaying data from multiple columns into a single line graph
Post Author: hollowmatrix
CA Forum: WebIntelligence Reporting
Hey,I have an issue with the WEBI reporting.I have a data source that has multiple columns say ( month1, month2, month3, month4,.....month 12, month 13, ....month24) with the sales data for each month.Now say I call the month 1 to month 12 as "current year", and call month 13 - month 24 as "previous year".I want to put a prompt in the report which allows me to select between "current year" and "previous year".Based on the prompt value we get a graph of the sales vs month ....as in if we select "current year", then we get a graph of the sales Vs time( remember that the sales data for each month is in a different column.)and if we select "previous year" then we get a graph of the sales Vs time for previous year..( sales vs time for Month 13, month 14, month 15....month 24).I am not able to pull data from multiple columns into a single object that I can use to populate the graphs.Any help on the same will be appreciated .Hi,
<p>
please click
here (asktom) and look for the words "how about the other way round"
</p> -
Select or deselect multiple rows with one single selection event
Does anyone know how to create a JTable which can select or deselect multiple rows with one single selection event in JTable. Fore example, if the table has
row1
row2
row3
row4
row5
row6
What I need is when user select row1 or row2, both row1 and row2 should be set to be selected. Then if user press CTRL and click one of row3 or row4, both of them should be selected including the previouse selected row1 and row2.
For deselection, if row1 and row2 are selected, when users deselect one of row1 or row2, both of them should be deselected.
Hopefully someone can give me a hint.Here is a partial solution using a JList. Only one line gets highlighted when the user makes a selection in the list. But, two lines are returned. There is a blank line between every two lines.
private void addLineToList() {
String a = f_one.getText();
String b = f_two.getText();
if (a.length() == 0) {
Utils.showInformationMessage("Item field is empty.");
f_one.requestFocusInWindow();
return;
if (b.length() == 0) {
Utils.showInformationMessage("Match field is empty.");
f_two.requestFocusInWindow();
return;
model.addElement("item: " + a);
model.addElement("match: " + b);
model.addElement(" ");
int size = model.getSize();
pairList.setSelectedIndex(size - 3);
f_one.setText("");
f_two.setText("");
f_one.requestFocusInWindow();
private void editList() {
if (pairList.getSelectedValue().toString().equalsIgnoreCase(" ")) {
Toolkit.getDefaultToolkit().beep();
f_one.requestFocusInWindow();
return;
if (!f_one.getText().equals("")) {
int result = JOptionPane.showConfirmDialog(this,
"The Item field contains text. Replace the text?",
"Flash Card Activity", JOptionPane.YES_NO_OPTION,
OptionPane.INFORMATION_MESSAGE);
if (result == JOptionPane.NO_OPTION) return;
if (!f_two.getText().equals("")) {
int result = JOptionPane.showConfirmDialog(this,
"The Match field contains text. Replace the text?",
"Flash Card Activity", JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE);
if (result == JOptionPane.NO_OPTION) return;
String item = "";
String match = "";
int index = pairList.getSelectedIndex();
String choice = model.getElementAt(index).toString();
if (choice.startsWith("item")) {
item = choice;
match = model.getElementAt(index + 1).toString();
model.remove(index);
model.remove(index);
model.remove(index);
else {
item = model.getElementAt(index - 1).toString();
match = choice;
model.remove(index + 1);
model.remove(index);
model.remove(index - 1);
int size = model.getSize();
if (size > 2) {
pairList.setSelectedIndex(size - 2);
f_one.setText(item.substring(6));
f_two.setText(match.substring(7));
f_one.requestFocusInWindow();
} -
How to submit data from multiple Input Ports in single SUBMIT button click
Hi,
I am in SPS8.
What exactly steps I need to perform to submit data from multiple Input Ports.
I couldn't able to submit One input Form and one Input Table to BAPI data service in single SUBMIT button click.
I debugged the VC application in SPS8.
While debugging, I found that when I click the SUBMIT button in the Input Form, Only data in that Input
form are being passed to the BAPI, But not the Table Form data.
If I click on the SUBMIT button in another Input Table, Only data from that table is being passed to the BAPI, but not the Input form data.
Essentially I need to submit both of them in one SUBMIT button.
Thanks,
RamakrishnaRamakrishna,
From the word document that you sent to me the steps you are missing to map the appropriate information into the BAPI is first you are not mapping all data rows into the table input port. To do this double click on the input table view and change your selection mode from single to multiple. Then when you click on your link between the BAPI and your input table you will see a new option appears under data mapping "Mapping Scope" select All Data Rows.
That's the first part of the problem to get the BAPI to recognize both the inputs coming from the form and the table eliminate the submit button from the form. Drag and drop a link from the output port of the table view to the Input port of the BAPI. Double click on the link between the BAPI and the table view and open the expressions editor for the two fields:
1/ Automatic Source
2/ SKIP_ITEMS_WITH_ERROR
On the hierarchical folder structure on the right expand expand the Data Fields node to find the fields from the form and map them accordingly.
Now when you hit the submit button on your table it should pass the BAPI all the parameters from both the form and the table.
Hope this helps,
Cheers,
Scott -
How do you receive data from multiple people on a single port?
I am trying to make a server where it receives the data from multiple users and then send it back to them all- multicasting audio to be exact. I tried setting it up but when i open the RTP session i get "can't open local data port" if i have more than one used connected to me. Does anyone have a solution? I didnt find much on the samples page and the multicast example from http://java.sun.com/products/java-media/jmf/2.1.1/apidocs/javax/media/rtp/RTPManager.html
didnt help either- i used the same ipaddress for the initialize and addtarget but i get "Local Data AddressDoes not belong to any of this hosts local interfaces". I am really in a pickle... If anyone can help me out that would be great!
EX: If A,B,C want to multicast they will all send to Server S using port 3000. Server S will create listeners for each of them using port 3000 and when received data it will send back to all of them at 4000. This is what i am trying to do... should i make multiple threads? would that help? thanks and please help!To send to everyone, you can send to a multicast address (choose one from 224.0.0.0 to 239.255.255.255), on a given port (2000). I don't have any code example here but it should very similar to unicast. As you said, you just have to register the Session and add a target with this same address.
I don't have any example myself, but you should find code example of both server and client around. It is a very common usage of jmf rtp.
I don't know how to mix several audio streams together (never had to do this), so I'm afraid I can't answer your other questions, sorry... The only way to know if it will slow down the transmission is to try. :) -
Select data from multiple servers(instances)
Hi All,
Is possible that we can login to SQLPLUS of one server and be able
to select data from other servers. For MSSQL server we can use
opendatasource but I don't know if in ORACLE we can
get the data from other servers by login to SQLPLUS of one server.
Your help is greatly appreciated.
Thanks in advance for your response.
JPHi,
Please try this ...
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE A_TABLE.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB2 OCCURS 0.
INCLUDE STRUCTURE B_TABLE.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB3 OCCURS 0.
INCLUDE STRUCTURE C_TABLE.
DATA: END OF ITAB3.
SELECT *
INTO TABLE ITAB1
FROM A_TABLE
WHERE A_ID IN S_A_ID.
SELECT *
INTO TABLE ITAB2
FROM B_TABLE
WHERE A_ID IN S_A_ID.
SELECT *
INTO TABLE ITAB3
FROM C_TABLE
WHERE A_ID IN S_A_ID.
To download to PC or application server, please check this sample codes.
http://www.sapdevelopment.co.uk/file/file_downloadpc.htm
http://www.sapdevelopment.co.uk/file/file_downloadsap.htm
Regards,
Ferry Lianto
Please reward points if helpful. -
How to select data from multiple dropdowns(HTMLDB)
Hi,
How to get the data from multiple dropdowns in the same report. Both the dropdowns are gerring data from the same table.
Ex:
abc-1st dropdown
pqr-2nd dropdown.
when abc and pqr are blank, it should display all records by default. If abc="some value" and pqr is empty then it should display all values corresponding to abc.
Regards,
PallaviPallavi,
I think this might be something you are looking for:
http://htmldb.oracle.com/pls/otn/f?p=31517:99
There are some examples on how to modify your SQL to get it working the way you want.
Denes Kubicek -
Extracting specific data from multiple text files to single CSV
Hello,
Unfortunately my background is not scripting so I am struggling to piece together a powershell script to achieve the below. Hoping an experienced powershell scripter can provide the answer. Thanks in advance.
I have a folder containing approx. 2000 label type files that I need to extract certain information from to index a product catalog. Steps to be performed within the script as I see are:
1. Search folder for *.job file types
2. Search the files for certain criteria and where matched return into single CSV file
3. End result should be a single CSV with column headings:
a) DESCRIPTION
b) MODEL
c) BARCODETry:
# Script to extract data from .job files and report it in CSV
# Sam Boutros - 8/24/2014
# http://superwidgets.wordpress.com/category/powershell/
$CSV = ".\myfile.csv" # Change this filename\path as needed
$Folders = "d:\sandbox" # You can add multiple search folders as "c:\folder1","\\server\share\folder2"
# End Data entry section
if (-not (Test-Path -Path $CSV)) {
Write-Output """Description"",""Model"",""Barcode""" | Out-File -FilePath $CSV -Encoding ascii
$Files = Get-ChildItem -Path $Folders -Include *.job -Force -Recurse
foreach ($File in $Files) {
$FileContent = Get-Content -Path $File
$Keyword = "viewkind4"
if ($FileContent -match $Keyword) {
for ($i=0; $i -lt $FileContent.Count; $i++) {
if ($FileContent[$i] -match $Keyword) {
$Description = $FileContent[$i].Split("\")[$FileContent[$i].Split("\").Count-1]
} else {
Write-Host "Keyword $Keyword not found in file $File" -ForegroundColor Yellow
$Keyword = "Code:"
if ($FileContent -match $Keyword) {
for ($i=0; $i -lt $FileContent.Count; $i++) {
if ($FileContent[$i]-match $Keyword) {
$Parts = $FileContent[$i].Split(" ")
for ($j=0; $j -lt $Parts.Count; $j++) {
if ($Parts[$j] -match $Keyword) {
$Model = $Parts[$j+1].Trim()
$Model = $Model.Split("\")[$Model.Split("\").Count-1]
} else {
Write-Host "Keyword $Keyword not found in file $File" -ForegroundColor Yellow
$Keyword = "9313"
if ($FileContent -match $Keyword) {
for ($i=0; $i -lt $FileContent.Count; $i++) {
if ($FileContent[$i] -match "9313") {
$Index = $FileContent[$i].IndexOf("9313")
$Barcode = $null
for ($j=0; $j -lt 12; $j++) {
$Barcode += $FileContent[$i][($Index+$j)]
} else {
Write-Host "Keyword $Keyword not found in file $File" -ForegroundColor Yellow
Write-Output "File: '$File', Description: '$Description', Model: '$Model', Barcode: '$Barcode'"
Write-Output """$Description"",""$Model"",""$Barcode""" | Out-File -FilePath $CSV -Append -Encoding ascii
Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) -
Create a view to shows data from multiple rows in a single column
Hi all - this is probably posted in the wrong forum but I couldn't find which was the correct one.
I am almost a complete novice at sql but I have a need to create a view which can be developed at 10g (which runs efficiently as the volumes are likely to be high) which will do the following.
Original table with columns Parent_code, Child_code
Parent_Code Child_Code
1000 2000
1000 3000
1000 4000
2000 3000
2000 5000
(note Parents can have multiple children and a child can have multiple parents!)
What I need to end up with in my view is the following
Child_Code Parent_List
2000 '1000 (3)'
3000 '1000 (3), 2000 (2)'
4000 '1000 (3)'
5000 '2000 (2)'
Note the number in parantheses is the number of children that the parent has - ie in the original table parent 1000 has 3 rows (one for each child)
This view is then to be used as a look up (on child code) for a business objects report.
Is there anyone who could PLEASE, PLEASE help me fairly quickly on this as I have very little time to find a solution?Hi,
You can test these ones :
select child_code
, ltrim(sys_connect_by_path(parent_info,', '), ', ') as parent_list
from (
select child_code
, to_char(parent_code) ||
' (' ||
count(*) over(partition by parent_code) ||
')' as parent_info
, row_number() over(partition by child_code order by parent_code) rn
from your_table
where connect_by_isleaf = 1
connect by prior rn = rn-1
and prior child_code = child_code
start with rn = 1
select child_code,
rtrim(
extract(
xmlagg(xmlelement("e",parent_info||', ') order by parent_info)
, '//text()'
) as parent_list
from (
select child_code,
to_char(parent_code) ||
' (' ||
count(*) over(partition by parent_code) ||
')' as parent_info
from your_table
group by child_code
;What you need is called "string aggregation".
See here for various techniques, including the two above : http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php -
SELECT data from two databases
I have two databases that I need to select data from in a
single SELECT. Using DWs Advanced window for creating the select I
don't see any way to select more than 1 Connection. Both databases
have unique user and passwords but reside on the same server. Any
idea how I can write a single SELECT to get data from both dbs. I
assumed it would be similar to selecting data from multiple tables
within the same db but the connection part is stumping me. Any
ideas would be greatly appreciated.TouchstonePress wrote:
> Page 48, Developing a Web Database Application . . .
speaks about making a
> database with two related TABLES each with the same
PRIMARY KEY column with
> which to identify a customer using their unique number.
That's the basic technique for joining two tables in the same
database.
The original poster has tables in different databases that
have
different user accounts and passwords.
Although it's possible to join two databases, you cannot do
it unless
you have one user account with the same privileges on both
databases.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
How to select data from structure
how to select data from structure
Hi Laxman,
Structure holds single record of data. You can acess data by using the syntax <b>Structure-field</b>
Please see sample.
data: wa_mara type mara.
select *
from mara
into wa_mara
up to 1 rows.
endselect.
write:/ wa_mara-mandt,
wa_mara-matnr,
wa_mara-maktl.
if helps plz reward points.
Regards
Bhupal Reddy -
** Is it possible to give select command from multiple tables in JDBC
Hi Friends,
Is it possible to give the select command to select data from multiple tables directly in the 'Query SQL statement' in JDBC sender communication channel ? (Instead of Stored Procedure)
Thanking you.
Kind Regards,
Jeg P.Hi,
here is a sample:
Table #1
Header
Name EmpId Status
Jai 5601 0
Karthik 5579 0
Table #2
Name Contactnumber
Jai 9894268913
Jai 04312432431
Karthik 98984110335
Karthik 04222643993
select Header.Name, Header.EmpId, Item.Contactnumber from Header,Item where Header.Name = (select min(Header.Name) from Header where Header.Status = 0) and Header.Name = Item.Name
Regards Mario -
Parsing of select query "select col1 from temp PARTITION(P01)" is failing.
Hi there,
create table temp (col1 varchar(255)) parallel partition by hash(col1) (partition p01, partition p02 ,partition p03)
"select col1 from temp PARTITION(P01)"
The above select query is failing while parsing in antlr-2.7.5.jar.
Caused by: com.database.sqlparser.InvalidSQLException:
at com.database.sqlparser.SQLParserHelper.doParseSelectQuery(SQLParserHelper.java:95)
at com.database.sqlparser.SQLParserHelper.parseSelectQuery(SQLParserHelper.java:26)
at com.database.jdbc.JDBCQuery.executeQuery(JDBCQuery.java:40)
at com.tasks.TempTask.call(TempTask.java:92)
at com.tasks.TempTask.call(LDCProcessorThread.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
... 1 more
Caused by: line 1:70: unexpected token: (
at com.database.sqlparser.ANSISQLParser.select_query(ANSISQLParser.java:277)
at com.database.sqlparser.SQLParserHelper.doParseSelectQuery(SQLParserHelper.java:91)
... 9 more
Thanks,
Sid
Edited by: user1945932 on Apr 5, 2010 7:33 AMIt would appear that the java backtrace here came from either client or middle tier java rather than java running in the database server. If so, this isn't the appropriate forum for this question. The JVM forum is for questions related to the Oracle proprietary Java VM that runs in the database server. Unfortunately I can't suggest a more appropriate forum as I don't recognize the code that appears to be in use.
-
Can I use Visual Basic to covert form user data from multiple .pdf files to a single .csv file? If so, how?
You can automate Acrobat using IAC (InterApplication Communications), as documented in the Acrobat SDK. Your program could loop through a collection of PDFs, load them in Acrobat, extract the form data from each, and generate a CSV file that contains the data.
Acrobat can also do this with its "Merge Data Files into Spreadsheet" function, but this is a manual process.
Maybe you are looking for
-
HT1918 remove my credit card from my account
I want to remove my credit card account from my itunes account.
-
Solution Manager help-desk VAR setup
I am setting up help desk in Solution Manager 4.0 The guide tells me to to execute report: AI_SDK_CF_GET_SUSR_VAR_CUST When I try to execute it in transaction se38 I get the following error: RFC_system_error Function module BCSN_Z001_VARS_SUSER_LIST
-
As of Yesterday, (27th Sept) My windows mail has stopped sending email to any of the IMAP accounts set up, I have seen this on multiple PCs with multiple IMAP accounts, so i'm pretty sure it's not a Mail server issue, and I have tried it via differen
-
Is it still possible to upgrade from CS4 to CS6 after the upgrade offer ended in 2012?
Is it still possible to upgrade from CS4 to CS6 after the upgrade offer ended in 2012? I have not found the option to do so.
-
How can I get photoshop cs2 to recognize me as administrator?
I have a legal version of cs2 that has worked well since I purchased it in 07. Recently it would seem to load fine but quit at the last minute. I have tried running the program as administrator. No luck. I have tried running as administrator thro