Query to search within several different tables...
Hello!
This is my first post, so be patient
Anyway, I have next tables in SAP B1 - OINV, OPCH, ORPC, ORCT, OVPM and all of those have DocNum, plus OJDT which has Number.
My problem is how to create query which will search through all of those values.
Problem is that those values are different, since series are different e.g. OINV.DocNum is from 10000 to 12000, OPCH.DocNum is from 15000 to 19999 etc...
I am not a newbie when it comes to SQL but this with the SAP B1 is completely new experience.
I will appreciate any help!
Thanks,
Dejan
hi,
Click open query generator, Click Execute, Click Pencil icon , Delete quey Select *
paste a query query editor,Click save button,save it in required category.
SELECT * FROM OINV T0 WHERE T0.DocNum >= [%0] AND T0.DocNum <= [%1]
SELECT * FROM OPCH T0 WHERE T0.DocNum >= [%0] AND T0.DocNum <= [%1]
SELECT * FROM ORPC T0 WHERE T0.DocNum >= [%0] AND T0.DocNum <= [%1]
SELECT * FROM ORCT T0 WHERE T0.DocNum >= [%0] AND T0.DocNum <= [%1]
SELECT * FROM OVPM T0 WHERE T0.DocNum >= [%0] AND T0.DocNum <= [%1]
SELECT * FROM OJDT T0 WHERE T0.Number >= [%0] AND T0.Number <= [%1]
Jeyakanthan
Similar Messages
-
How to use dynamic select query which queries from 3 different table.
Hi All,
I am new to Toplink, i would like to use a named query to select some of the columns from 3 different tables with dynamic where clause.
I have used the following lines. Please tell me how to get code for the dynamic where clause.
First try :
Vector objPersons = (Vector)session.executeQuery("findPersonByGlobalID",Person.class,vQueryArguments);
The above method is not returning the vector or collection.
Second Try:
ReadAllQuery query = new ReadAllQuery(Person.class);
query.useCollectionClass(LinkedList.class);
LinkedList person = (LinkedList) session.executeQuery(query);
The second try is returning the collection but, this fetches all the record from the table.
1. How to query for range of records?
2. How to query from multiple tables for some range. How to use dynamic range values ?
Please reply with your answers or some pointers would help.
Thanks and Regards,
Vijay.BHi,
Did you try using a SQLCall ? It might be able to satisfy you requirements .. :-
Employee employee = (Employee) session.executeSelectingCall(
new SQLCall("SELECT * FROM EMPLOYEE WHERE EMP_ID = 44")
);You can get more information here :-
http://www.oracle.com/technology/products/ias/toplink/doc/1013/MAIN/_html/qrybas004.htm
Regards,
Sandeep -
Query to search in all schema tables for a 'filed value'
Hi,
Can u help me out on this ?.
I want a sql query to search for one field value in all the schema table.
or do we have something in toad to check for thisPlease follow this thread.
How to select all records from all tables where SCORE = 99
-aijaz -
SQL Query to search all the tables for a given string
Hi all,
This is concerning a query to search each and every table/column for a given string.
I came across a similar post (Re: question about searching 600 tables and this query seems to be inline with my requirements:
select table_name,
column_name,
:search_string search_string,
result
from cols,
xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
columns result varchar2(10) path '.'
where table_name in ('MY_TABLE')
However, I am getting the following error:
ORA-24451: OCIKCallPushTrusted, Maximum call depth exceeded
I am using Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit and could you please let me know the best possible way to accomplish this task?
Thanks.
Edited by: itech.quest on Sep 19, 2010 8:30 AMHi Tamir,
Thanks so far. I am yet to make the crucial breakthrough as far my application goes. Are you talking about the EUL5_QPP_STATS table? I tried retrieving worksheets even from that table also with the following query
SELECT DISTINCT Eul5QppStats.QS_DOC_NAME,Eul5QppStats.QS_DOC_DETAILS
FROM EUL5_QPP_STATS Eul5QppStats,EUL5_DOCUMENTS Eul5Documents
WHERE Eul5QppStats.QS_DOC_NAME = Eul5Documents.DOC_NAME
However, the worksheet data retrieved by Discoverer Oracle's product is not matching my dataset for every workbook. Please suggest.
Reg
Thomas -
String Search Query in any columns in any table in a database
Hi All,
I am trying to search a word which starts with 'FRA' in any columns and any tables.
I am unable tofind what is generating a join datasets in the webservice from teh database as it is not apparent within teh 100 tables.
I ahve looked into
Re: How to search in all rows and all columns?
Re: SQL Search Query - HELP!
but none of these queries is working out for me as I am a user with no tables on its own but rather a user quering other tables.I think its a tweak on which dat adisctionary I can view
select distinct substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from all_cons_columns,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || 'fra'
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
order by "Table";
running teh above query got me thsi error:
ORA-19202: Error occurred in XML processing
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_XMLGEN", line 288
ORA-06512: at line 1
19202. 00000 - "Error occurred in XML processing%s"
*Cause: An error occurred when processing the XML function
*Action: Check the given error message and fix the appropriate problem
Any help is much appreciated
Edited by: CrackerJack on Sep 3, 2012 5:55 PM
Edited by: CrackerJack on Sep 3, 2012 5:55 PMHi,
CrackerJack wrote:
Hi All,
I am trying to search a word which starts with 'FRA' in any columns and any tables.
I am unable tofind what is generating a join datasets in the webservice from teh database as it is not apparent within teh 100 tables.
I ahve looked into
Re: How to search in all rows and all columns?
Re: SQL Search Query - HELP!
but none of these queries is working out for me as I am a user with no tables on its own but rather a user quering other tables.I think its a tweak on which dat adisctionary I can view In all_<b>cons</b>_columns, "cons" stands for "constraints". That view only includes columns that have a constraint on them.
Use all_<b>tab</b>_columns if you're interested in all columns in all tables.
select distinct substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from all_cons_columns,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || 'fra'
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
order by "Table";You may have noticed that this site noramlly compresses whitespace.
Whenever you post formatted text (such as query results) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
When referencing a table in a differenct schema, you must qualify the table name with the owner (unless there happens to be a synonym). For example, if you are connected as some user other than scott, and you want to use the emp table that is in the scott schema; then you can't just say "SELECT ... FROM emp;", because that would look for the emp table in yur own schema. You have to say "SELECT ... FROM <b>scott.</b>emp;" instead. If the table is in your own schema, then the scema name is optional. The OWNER column in all_tab_columns gives the schema name.
running teh above query got me thsi error:
ORA-19202: Error occurred in XML processing
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_XMLGEN", line 288
ORA-06512: at line 1
19202. 00000 - "Error occurred in XML processing%s"
*Cause: An error occurred when processing the XML function
*Action: Check the given error message and fix the appropriate problemSorry, I don't know what causes that error.
If I use the data dictionary view cols (as in {message:id=3325696} which you cited), it runs correctly.
If use what I though was the equivalent data dictionary view, user_tab_columns, or if I use all_tab_columns or other data dictionary views, then I get those errors. I'm using Oracle 10.2.0.1.0.
Edited by: Frank Kulash on Sep 3, 2012 10:45 PM
John Spencer noticed the same problem 5 years ago. See {message:id=1969268} -
Best practice for a same query against 2 different tables
Hello all,
I want to extract info about tablespaces storage, both permanent and temporary. For that I use 2 different cursors that do exactly the same query but against a different table (dba_data_files and dba_temp_files).
CURSOR permanentTBSStorageInfo (tablespaceName VARCHAR2) IS
SELECT file_name, bytes, autoextensible, maxbytes, increment_by
FROM dba_data_files
WHERE tablespace_name = tablespaceName;
CURSOR temporaryTBSStorageInfo (tablespaceName VARCHAR2) IS
SELECT file_name, bytes, autoextensible, maxbytes, increment_by
FROM dba_temp_files
WHERE tablespace_name = tablespaceName;
First I'm bothered that I have to use 2 cursors to execute the same query against 2 different tables. Is there no another way around?
Then I fetch the results of this cursors in 2 different loops because I didn't find a way to dynamically call the cursors. I am looking for best practice here, knowing that I will do the same parsing against the results of the 2 cursors.
Thank you,Hi
Check whether the below query is helpful or not
select fs.tablespace_name "Tablespace",
fs.tempspace "Temp MB",
df.totalspace "Total MB"
from
(select
tablespace_name,
round(sum(bytes) / 1048576) TotalSpace
from
dba_data_files
group by
tablespace_name
) df,
(select
tablespace_name,
round(sum(bytes) / 1048576) tempSpace
from
dba_temp_files
group by
tablespace_name
) fs
where
df.tablespace_name = fs.tablespace_name;
Thanks -
Search a value in one field contained in different tables
In my database, a field name is used in more than one table. For example, the field 'ITEMCODE' is available in TABLE1, TABLE2, TABLE3, etc... Can anyone please suggest a query to search a particular value in this field in all tables ? Thanks for your answers.
The query you need depends on the datatype of the column you need.
you could try this for a number:
select 'select '||column_name||' , '''||table_name||''' table_name from '||table_name||' where '||column_name||' = '||Yournumbervalue||' union '
from user_tab_cols
where column_name = 'Your_column_name'or a varchar2:
select 'select '||column_name||' , '''||table_name||''' table_name from '||table_name||' where '||column_name||' = '''||YourVarchar2value||''' union '
from user_tab_cols
where column_name = 'Your_column_name'user uppercase for Your_column_name, strip off the last union and you might have what you're looking for... -
Is there any way to improve Query which searches XML data from a table??
hi all,
i have a table which have one column say 'colA' as Varchar(max) datatype which i save xml data and it have other cols too
Currently i am searching data inside this table using like operator
eg:
Select * from tablename where colA like ‘%<tagname>parameterstringvalue</tagname>%’
when i check with the Execution plan i could see it Takes 82% for clusterd index scan ( primarykey col
not ColA)
i added new non clusterd index for the same with include col as ColA and i found nonclusterd index scan
with same estimated I O cost and Extimated operator cost as clusterd index scan
My Question is :-
1. why didnt nonclusterd index seek come?
2. In What way i can improve perfomance for such situvation? i had seen couple of post suggesting to rewrite the Query as SELECT
* FROM myTable WHERE CONTAINS (myCol1, myCol2, "myString").
I Try creating Full text index and found cost increased compared to the original Query ?
3. As per my assumption the wild charecter ('%') in begining makes perfomance issue is there any option
or an alternative for such case?hi...i can give a skeleton
--Table Structure------------
Table1:-
(colA - int(PK),
ColB - Varchar(max),
ColC-uniquieidentifier,
ColD-datetime,
ColE-Bit)
It have clusterd index for ColA
Table2:-
(ColA-int(fk)
colF-int(pk)
colG-varchar(max),
ColH-uniqueidentifier,
colI-int,
colJ-int
ColK-date)
-----------------Query Skeleton-------------------:
select Distinct
s.colA,
s.ColB,
S.colC,
S.colD
from Table1 s with (nolock)
left outer join table2 Q with (nolock) on s.colA=q.ColA
where Q.ColA is null
and s.colB like '%<tag>sometext</tag>%'
and s.colD >='1/1/2010'
and s.colD <='1/1/2014'
i hope this will help to understand it clearly......... -
Query tuning for search within blob content.
Hi,
I ve got a query which searches across 3 tables. When I include a search condition : (CONTAINS(CF.blob_content,''{''||:P146_TEXT||''}'',1)>0 AND CF.REF_ID = CR.REF_ID) the query takes really long time to execute. Is there a way to reduce the execution time. If you need any more info on this, please let me know. I need to work out a solution for this issue really soon.
I have indexed the blob_content column using a domain index type.
Thanks,
VigneshHi,
an explain plan would be helpful.
Is it possible to use the bind variable already include the "{", i mean :P146_TEXT := '{'||:P146_TEXT||'}' and then use :p146_text solely in the contains. Then you are using a real bind variabel. Maybe a second variable is necessary to make it work.
Another possibility is that CF.REF_ID is not indexed or CR.REF_ID is not indexed, that's way it's handy to give an explain plan. Then you can see maybe the problem.
Herald ten Dam
Superconsult.nl -
How to display search results in a table or in different columns
Hi
How can i display search results in multiple columns or in a table so that the user can sort the results based on a particular property displayed in the search results.
Thanks in advance
Regards,
VidyaHello,
To display search results in a table, in different columns or more... you should modify SearchResultLayoutSet.
Create your own StandardSearchResultRenderer (exp My_StandardSearchResultRenderer) and add to SearchResultLayoutSet. Than change whatever you like to achive your aim.
Thank you.
Hope this helps. -
Query on Creating and Populating I$ table on different condition
Hi,
I have a query on creating and populating I$ table on different condition.In which condition the I$ table is created??And These condition are mentioned below:
1)*source and staging area* are on same server(i.e target is on another server)
2)*staging area and Target* are on same server(i.e source is on another server)
3)*source,staging area and Target* are on *3 different* server
4)source,staging area and Target are on same server
ThanksI am not very much clear about your question. Still trying my best to clear it out.
In your all above requirement I$ table will be created.
If staging same as target ( One database,one user) then all temp tables will be created under this user
If staging is different than target ( One database,two user (A,B)) then all temp tables will be created under this user A (lets consider) and data will be inserted to the target table that is present in user B
If staging is different than target ( Two database,two user (A1,A2), not recommended architecture) then all temp tables will be created under this user A1 (database A1) and data will be inserted to the target table that is present in user A2 (database A2)
If source,staging,target will under one database then No LKM is required,IKM is sufficient to load the data into target. Specifically for this you can see one example given by Craig.
http://s3.amazonaws.com/Ora/ODI-Simple_SELECT_and_INSERT-interface.swf
Thanks. -
Combining of 2 different tables in to a query/view
Hi
I have 2 tables one is emp for employee details and another for courses for the courses which employee undergone.I want to create a view that contains the employees with each category went to the courses and rest of the employees didnt attended the courses in that group.The view or query should be combination of emp group wise by designation/groups who attended the courses and who didnt attended the courses.just an exmple of tables
Courses
emp emname job course
1 jon clerk msoffice
1 jon clerk office automation
2 rahul officer office automation
2 rahul officer spoken english
3 shyam officer spoken english
4 raj Manager office automation
Emp
empno ename job
1 jon clerk
5 ben clerk
2 rahul officer
3 shyam officer
6 rahim officer
4 raj manager
7 sandya manager
rgds
rateeshHi, Rateesh,
Sorry, I'm not sure I understand the problem. It would really help if you posted the results you want to get from the view.
Do you want to get all the information from the courses table, plus one row (from the emp table) for every employee who is not in the courses table?
The normal way to do that is an Outer Join.
For example, if you want to see all the departments (from the scott.emp table), and all of the employees in each department (from the scott.emp table), and you also want to see departments with no employees, you can say:
SELECT d.deptno
, e.ename
FROM scott.dept d
LEFT OUTER JOIN scott.emp e ON d.deptno = e.deptho;Since your tables are denormaliized (that is, the empname and job are repeated in different tables), you can also do that with a UNION, like you tried. You'll get all of the data from the courses table (for the employees who are in the courses table), and the data from the emp table, but only for the employees who are not in the courses table. You can put a literal NULL in the course column of SELECT clause, since these people will have no course.
Using the scott.dept and emp tables, here's how to simulate an outer join with a UNION.
SELECT deptno
, emp
FROM scott.emp
UNION
SELECT deptno
, NULL AS emp
FROM scott.dept d
WHERE NOT EXISTS ( -- Make sure this department is not in the emp table
SELECT NULL
FROM scott.emp
WHERE deptno = d.deptno
);You should be able to use either of these techiques to get the view you want. Your emp table corresponds to scott's dept table, and your courses table corresponds to scott's emp table. That is, you can have 0 or more courses per emp, in much the same way that scott can have 0 or more emps per dept. -
How to Query Multiple Fields from different Tables using Toplink Expression
Hi,
I am trying to prepare an Oracle Toplink Expression to qurey the multiple columns of different tables. the query as following. Please can anyone help?
SELECT CYCLE.CYCLE_ID,
CYCLE.ASPCUSTOMER_ID,
CYCLE.FACILITYHEADER_ID,
CYCLE.ADDUSER,
ASP.FIRSTNAME || ' ' || ASP.LASTNAME ADDUSERNAME,
CYCLE.ADDDATE,
CYCLE.LASTUPDATEUSER,
ASP.FIRSTNAME || ' ' || ASP.LASTNAME LASTUPDATEUSERNAME,
CYCLE.LASTUPDATEDATE,
CYCLE.CYCLENAME,
CYCLE.CYCLENUMBER,
CYCLE.DESCRIPTION
FROM CYCLE,ASPUSER ASP
WHERE CYCLE.ADDUSER = ASP.ASPUSER_ID
and then i want to send that expression to readAllObjects method as a parameter
Expression exp = (..............this is the required qurey expression...................)
Vector employees = session.readAllObjects(getClass(), exp);
thanks,You havent given any information on the mapping between Cycle and Asp. I presume there is a one to one mapping between them. Also it appears there is no "WHERE" clause to limit the number of cycles being retrieved. If that is the case then I presume you want to load all cycles in the system.
Thats just a clientSession.readAllObjects(Cycle.class). If you have indirection turned on the Asp should get loaded when you do a cycle.getAsp().
I presume that SQL you posted loads all the columns of CYCLE and ASP. If you are interested in a subset of CYCLE or ASP then you should do a ReportQuery or partial object read.
Hi,
I am trying to prepare an Oracle Toplink Expression
to qurey the multiple columns of different tables.
the query as following. Please can anyone help?
SELECT CYCLE.CYCLE_ID,
CYCLE.ASPCUSTOMER_ID,
CYCLE.FACILITYHEADER_ID,
CYCLE.ADDUSER,
ASP.FIRSTNAME || ' ' || ASP.LASTNAME ADDUSERNAME,
CYCLE.ADDDATE,
CYCLE.LASTUPDATEUSER,
ASP.FIRSTNAME || ' ' || ASP.LASTNAME
LASTUPDATEUSERNAME,
CYCLE.LASTUPDATEDATE,
CYCLE.CYCLENAME,
CYCLE.CYCLENUMBER,
CYCLE.DESCRIPTION
FROM CYCLE,ASPUSER ASP
WHERE CYCLE.ADDUSER = ASP.ASPUSER_ID
and then i want to send that expression to
readAllObjects method as a parameter
Expression exp = (..............this is the required
qurey expression...................)
Vector employees = session.readAllObjects(getClass(),
exp);
thanks, -
TREX - ECC 6.0 searches in different tables
Hi, have some search related questions:
- Is it possible to use TREX for combined searches from non-indexed tables in ECC 6.0 (where data is stored in different areas such as material, classification, BOM, customers, vendors, address data and so on)?
- Is it possible to mirror tables in ECC 6.0 to TREX via change pointers so the search data is "fresh" (the returned search result will be used in combination with other data and then stored back to ECC 6.0 from the NW portal)?
- Is it possible to have cross related search attributes (fields from material master, classification, bom, dms, address and so on) on the same tab in the sap standard search help (sap search help will be called from ABAP WebDynpro's)?
The main issue is to do combined searches with different combinations (number of input fields (10-20) related to different modules/areas) in ABAP WebDynpro. To do searches with outer table joins in tables without
keys and indexes seems not be doable.
/Brg Patrick OlssonHi lorenzo,
I have successfully installed ECC6.0 IDES SR2, i have found ECC-DIMP 6.0 LEVEL 6 in Support packs, please could you tell me that how can i activate IS-MILL in my server and what are the preconditions.
Thanks and Regards
ChandraB. -
Update two different tables by a single sql query:
Hi All,
i need to update two different talbes in a single sql query..
i m using the following query
UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12
AND
UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
i m getting the following error:
Odbc driver returned an error (SQLExecDirectW).
Error Details
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 17001] Oracle Error code: 936, message: ORA-00936: missing expression at OCI call OCIStmtExecute: UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12 . [nQSError: 17011] SQL statement execution failed. (HY000)
SQL Issued: EXECUTE PHYSICAL CONNECTION POOL writeback UPDATE FT_User_Alert SET Subscription = 'W' where product_key=1 and measure_key = 12 AND UPDATE LU_Monthly_Alert_Budget_Sheet SET Min_Red_Range ='16.0' AND Max_Green_Range ='24.0'AND Max_Red_Range ='27.0'AND Min_Green_Range ='16.0' where product_key='1' and measure_key = 12
but when i m ushin the same query in Microsoft SQL Server it executes properly:
please help me out...Duplicate thread. I've already answered on your other thread...
update two different tables by a single sql query:
Maybe you are looking for
-
Pages can't open Pages09 documents from MobileMe
I have a number of files created with Pages '09 on my iDisk. When the files are downloaded with GoodReader they appear as Folders, and Pages-iPad can't open them. Is there a way to open Pages documents stored on iDisk with iPad? Regards
-
Should i upgrade from Snow Leopard to Lion on my Macbook Air1,1 ?
Hi, I just found out the Macbook Air i bought from my friend recently isn't compatible to upgrade to Mountain Lion. I'm very dissapointed, but thought i would upgrade to OS X Lion instead, so at least i would be able to use iCloud. Two problems: Thi
-
TO_DATE and bind variables in SQLJ
Hi all I need to convert a date, in string format using TO_DATE in an INSERT INTO contained in a sqlj class. The reason for this is I am reading in data from a pipe delimited file created by a MUMPS application. (Don't ask:)). This works fine if I us
-
JVM Crashes in Native Code - JDK#1.4.2_10 for solaris-sparc
Hi, We are facing irregular but quite frequent JVM crash in our Test environment. From the stacktrace it seems that JVM is crashing inside the native code. Can anyone help me in finding the cause of this problem please? Please find below the dump gen
-
BSOD in Windows 8.1 : System Service Exception
Hi I am facing random BSOD for the past 3-4 days. Not sure whats causing it System dump uploaded to https://onedrive.live.com/redir?resid=549662200102E92E!2559&authkey=!APDJCQD0uddCzzU&ithint=file%2cdmp Please help