Query between schemas
We are migrating our application from SQL Server 2005 to ORacle 9i. We used to have queries that extracted data between different databases in SQL Server, we've encountered problems doing the same in ORacle. What used to be separate Databases in SQL Server appear now as different Schemas in Oracle. Ive read about Database Links and making use of them in our queries but Im not sure if this applies here since we are using the same database, just different schemas.
I appreciate your help,
JD
JD,
In FROM clause you can specify the schema, for example:
SELECT *
FROM s1.t1,
s2.t2
WHERE ...Also, you need to grant access accordingly. If the query is executed by user (schema) s1, then s1 must have SELECT privilege to read data in table s2.t2.
GRANT SELECT ON s2.t2 TO s1Finally, you do a better job if you use roles, not granting privileges direct to users.
Read about grants and roles.
Regards,
Miguel
Similar Messages
-
Parallel database connection​s and single query between databases
Hi, I am looking to execute this SQL query between 2 different databases to update a local database based on data selected from a remote one.
e.g.:
- Local database name: db1
- local database schema: dbo
- local database table1
- remote database name: db2
- remote database schema: dbo
- Remote database table: table2
- Query: "SELECT * FROM db2.dbo.table2 WHERE NOT EXISTS(SELECT * FROM db1.dbo.table1)" <- This gets e the record set i would need to insert, and I already have a vi to do that kinda thing.
How do I go about this?
Thanks,
MohamedMohamed,
There is a VI in the Database Connectivity Toolkit that allows you to execute SQL queries: DB Tools Execute Query.
http://zone.ni.com/reference/en-XX/help/370016E-01/lvdatabase/db_tools_execute_query/
Is this what you are looking for?
Drew T.
NIC AE Specialist -
Difference between schema and DTD
Difference between schema and DTD
<author>
<firstname></firstname>
<lastname></lastname>
</author>
How will u write dtd and schema for above XML ?DTD:
<!ELEMENT author(firstname, lastname)>
<!ELEMENT firstname(#PCDATA)>
<!ELEMENT lastname(#PCDATA)>
Schema:
<xs:element name="author">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element> -
Error while copy query between infocubes
I was trying to copy a query between infocubes and ended with error message.
Query copied from Infocube A to Infocube B. Infocube B has an additional dimension with 2 char's when compared to infocube A.
Using transaction RSZC, I tried to copy the query, but ended up with following error..
1.Program error in class COPY_QRY_TO_CUBE method : UNCAUGHT_EXCEPTION
2.An exception with the type CX_SY_OPEN_SQL_DB occurred, but was neither handled locally, nor declared in a RAISING clause
3.The system tried to insert a data record, even though a data record with the same primary key already exists
I also tried using function module RSZ_I_COPY_QRY_TO_CUBE, which was of no help. I get the following message with the function module...
1. Program error in class RS_TESTFRAME_CALL method : UNCAUGHT_EXCEPTION
2. An exception with the type CX_SY_OPEN_SQL_DB occurred, but was neither handled locally, nor declared in a RAISING clause
3. The system tried to insert a data record, even though a data record with the same primary key already exists
I have also tried a solution in BW expert by using debugging mode of the above function module, again this was of no help..
I am BI 7.0 SP09...
Any ideas, Please....
Thanks,
RR
Message was edited by:
Ray RHello,
Are you trying to copy Business Content delivered Queries?
I had also got this error when copying over all queries from one cube to another. Reason for this message was plain simple - I did not realise that the sender Cube had Business Content Query which we cannot copy over using RSZC as system tries to create another query with suffix as 0****_1. We cannot create query in SAP user namespace. Error message is different then the reason behind it.
Thanks
Ravi -
Creating SELECT query between 3 tables
Hi there,
Im trying to create a SELECT query between 3 tables and it is driving me round the bend.
I have 3 tables connected together which are:
MODUL
modulid
modulname
modulevel
STUDENT
studentid
surname
inits
s e x
phone
email
logon
STUDREGOCCUR
modulid
acyear
semester
occletter
studentid
result
I want to select the fields surname, inits, studentid from the STUDENT table, modulname from the MODUL table and result from my STUDREGOCCUR table that is NOT NULL.
I have tried SELECT STUDENT.STUDENTID, STUDENT.INITS, STUDENT.SURNAME, MODUL.MODULNAME, STUDREGOCCUR.RESULT WHERE STUDREGOCCUR.RESULT IS NOT NULL;
I have also tried many other ways and done research hwich hasnt really helped me unfortunately.
Im quite new to SELECT queries and im not sure where im going wrong, i would greatly appreciate if someone could help me solve my problem.
Thanks for the help :)
Edited by: user633643 on 06-Dec-2008 08:09If you want data from multiple tables you would need to perform a join. The general form would be:
select t1.cola, t2.col2, t3.col.x
from table_a a, table_b b, table_c c
where a.key = b.key
and b.key = c.key
or perhaps c relates back directly to a so it is a.key = c.key where key can be any column whose value is equilivent in what it represents to the value it is being compared to, that is, student_number = student_number or the columns regardless of name are both building numbers, room numbers, etc ....
This is not your exact solution but it should help.
HTH -- Mark D Powell -- -
Select Query Between two dates...
Hi Guru's,
I need a Select Query between two dates, also if the record not found for any in between date then it should return NULL or 0 ...
for Example
1. I am having two records in DB for date 2-10-2008 & 4-10-2008
2. Now suppose I have given Query for date between 1-10-2008 to 5-10-2008
Then it should return me 5 records with valid values for 2 & 4 and NULL for other 1,3,5
Thanks.Try like this:
with
t as
select date '2008-10-02' as dt, 'Record #1 (in DB)' as str from dual union all
select date '2008-10-04' as dt, 'Record #2 (in DB)' as str from dual
select v.dt, t.str
from (
select date '2008-10-01' + level - 1 as dt
from dual
connect by level <= (date '2008-10-05' - date '2008-10-01') + 1
) v
left join t
on v.dt = t.dt
order by 1 -
Query between different infoproviders
How to copy query between different infoproviders?
Hi,
It can be done throught he transaction RSZC
1) Run the Code RSZC and Input the Source and Target infoprovider name.Execute it.
2) Next screen you will get the option of which query to copy, select the query.
3) Go to next screen and change the name of the query that is in the destination. (If you want).
4) Next screen, Message is displayed if success or failure.
Important Note : This function allows you to copy queries and their subobjects
(structures, calculated key figures, and restricted key figures) between different InfoCubes. Note that the target InfoCube, that is the cube with the query copies, has to contain all the InfoObjects that are contained in the source InfoCube (InfoCube with the original queries) -
Joins query between itab and database table..
Hi all,
Is it posible to use joins query between internle table and data base table...Hi Mehboob,
No thats impossible to join the internal table and the database table.
Alternatively what you need to do is you need to execute a Queryin Database Table and use the For All Entries in itab.
Eg: Select * from marc into table it_marc
for all entries in it_matnr
where matnr = it_matnr-matnr.
Thanks,
Chidanand -
Re: DIfference between Schemas, PCRS' FUnctions and Operations
Dear SAPExperts,
Can anybody pls tell me what is difference between Schemas, PCRS' Functions and Operations.
Thanx in advance
Regards
AniruddhaHi Aniruddha
When the payroll driver is executed (for ex: PC00_M40_CALC for INDIA is executed) the schema IN00 (standard schema) is executed and it calls certain functions (functions may use Rules. Rules contain Operation) and also subschemas.
Functions could be of four types
1. Performing some payroll computations (E.g. INEPF function calculates the PF amount of an employee during payroll run)
2. Calling rules (E.g. P0045 function calls a rule INLN to compute the loan details of a personnel number).
3. Getting data from Infotypes (E.g. P0581 will get the data from Infotype-581 for payroll processing).
4. For some decisions. (E.g. IF & ENDIF function is used to execute as per the true and false decisions) etc.
When the PY is executed SAP uses lot of Internal Tables to store data and also provides data to other internal tables.
The read and change access to Internal Tables is enabled using functions that are executed in a personnel calculation schema and using operations that are executed in personnel calculation rules.
The following is just an attempt to provide some info on how Functions are processed during the PY Run. For ex: (functionality of subschema XIN0 and INBD)
1. INITIALIZATION OF PAYROLL: When the Payroll is executed first the subschema XIN0 is called, This subschema comprises the following main steps:
I. Specify program type (payroll or evaluation)
II. Set switch for database updates (YES/NO) all database updates are controlled via this switch (otherwise simulation)
III. Only infotypes from the HR master record which apply to the selected personnel number are read.
IV. All Time Management infotypes are imported.
V. Specify check against control record PA03 (test or live).
2. READ BASIC DATA: Once the Initialization of Payroll is successful, the subschema INBD is called. This subschema reads the Basic data of an employee who is there in the Payroll execution. Basic Data includes, determining Employee Name, Reading Work Center/Basic Pay Data, Setting Financial Year Dates and Allowance Grouping Tables, Reading Previous Employment Tax Details, Reading Housing (HRA/CLA/COA), Reading Exemptions, Reading Income from Other Sources, Reading Section 80 Deductions, Reading Investment Details (Sec 88), Reading Provident Fund Contributions, Reading Other Statutory Deductions, Reading Car and Conveyance, Reading Long Term Reimbursements, Read ID Details. Function GON checks whether all the master data has been imported, no further processing of schema will occur unless certain data is present.
The Subschema INBD calls the following functions in order to read the Basic Data:
ENAME :
Function ENAME reads the last valid name of the employee in the payroll period. The formatting used for the country in question is used when displaying this name.
WPBP
If an employee receives a pay increase within a payroll period, the Basic Pay infotype (0008) is changed and delimited as of a specific date. Two data records exist for one payroll period.
During payroll, the system writes the Basic Pay wage type to the results table with two different indicators. These split indicators are a link to the WPBP table that contains the relevant values. The system takes into consideration both data records for the corresponding partial periods when calculating remuneration.
ININI
P0580
P0581
P0582
P0584
P0585
P0586
P0587
P0588
P0583
P0590
P185I
GON :
Function GON checks whether all the master data has been imported. No further processing of the schema will occur unless certain data is present. Checking procedures vary from country to country. There must always, however, be a work center (P007).
[Def. of Functions, Rules and Operations (copied from Raju's answer)
Schema is a collection of functions
A Rule is a collection of operations.
An operation is a very basic piece of logic that is used, mostly, to manipulate wage types
Best Regards
Reddy -
Query between two tables : COAS and BPGE
Hi,
I want to create a Query between tables : COAS and BPGE but when i generate the Info-set the system had a problem of jointure. (the field OBJNR exist in the both)
By this query i want to display the Order and the value of Budget
Please Advise
Regardshi..
you can go with following type of code....
select coas~field1
coas~field2
bpge~field5
bpeg~field6
from coas inner/outer join bpge
on coasobjnr = bpgeobjnr
into table t_table
where condition
hope this one will solve the issue
regards -
Urgent - I have written select query between loop and endloop, Ple help out
Can any one help out me on this select query. I have written select query between loop and endloop. When I execute the program it will take too much time in this query. Please help me out. Its very urgent.
LOOP AT l_i_invoices ASSIGNING <l_invoices>.
CLEAR alv_wa.
alv_wa-bukrs = <l_invoices>-bukrs.
alv_wa-gsber = <l_invoices>-gsber.
CLEAR l_instid.
CONCATENATE <l_invoices>-belnr <l_invoices>-gjahr INTO l_instid.
SELECT top_wi_id FROM sww_wi2obj INTO TABLE l_i_swwwihead
WHERE catid = c_catid_business_object
AND instid = l_instid
AND typeid = c_typeid_invoice
AND removed = space
AND ( wi_rh_task = c_task_buyer_message
OR wi_rh_task = c_task_buyer_message2 ).
IF sy-subrc = 0.
<l_invoices>-flag = 'X'.
ELSE.
<l_invoices>-flag = ' '.
ENDIF.
MODIFY l_i_invoices FROM <l_invoices> TRANSPORTING flag
WHERE belnr = <l_invoices>-belnr
AND gjahr = <l_invoices>-gjahr.
APPEND alv_wa TO i_alv.
ENDLOOP.
Thanks in advance.Here is a way to solve this problem.
Choose somewhere before this loop processing to use that select. Therefore, you'll need use FOR ALL ENTRIES <that_loop_table> clause, and in the WHERE condition you need to specify that same fields.
This way, you will have an internal table with all data you'll need to check.
Then, inside your loop statement, use the READ TABLE command with the clause WITH KEY field = value, to read that record and use the value found.
Like this sample:
SELECT bukrs lifnr umsks umskz augdt augbl zuonr gjahr belnr buzei
waers xblnr blart gsber ebeln zfbdt zbd1t zlsch
INTO TABLE tg_bsak
FROM bsak
FOR ALL ENTRIES IN tl_bkpf_sel
WHERE bukrs EQ tl_bkpf_sel-bukrs AND
lifnr IN s_lifnr AND
augbl EQ tl_bkpf_sel-belnr.
LOOP AT tg_bseg INTO wa_bseg.
READ TABLE tg_bsak INTO wa_bsak WITH KEY bukrs = wa_bseg-bukrs
gjahr = wa_bseg-gjahr
belnr = wa_bseg-belnr
BINARY SEARCH.
if sy-subrc = 0.
* do something
endif.
ENDLOOP. -
Query between two date columns ?
Oracle 11g R2
I'm trying too create a query between two date columns. I have a view that consists of many columns. There are two columns in question called valid_to and valid_from
Part Number Valid_from valid_to
100 01/01/2000 01/01/9999
200 01/01/2000 01/01/9999
300 01/01/2000 01/01/9999
etc
If I want to only see rows between with a date range of 01/01/2000 and 01/01/2013 how can I put this as SQL ?
Thanks in advanceHi,
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), so that the people who want to help you can re-create the problem and test their ideas.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
See the forum FAQ: https://forums.oracle.com/message/9362002
If you want to find rows that have that exact range, then you can do something like
SELECT *
FROM table_x
WHERE valid_from = DATE '2000-01-01
AND valid_to = DATE '2013-01-01'
If you want to find rows where any or all or the range on the row overlaps any or all of the 200-2013 target range, then
SELECT *
FROM table_x
WHERE valid_from <= DATE '2013-01-02
AND valid_to >= DATE '2000-01-01'
If you want rows that are enritely within the target range, it's something else.
If you want rows that entirely enclose the target range, it's something else again. -
Diffrence between Schema IN00 ,INNR and INN1
Hi,
Pls let me know the differences between Schema IN00,INN1 and INNR and when we use which one?
Regards,
AnusuiyaDear
in Schema IN00 we have sub schema INN1 , INNR
the first one is related to Gross to Net payment , Which includes all the statutory related function and PCRs the next one is relaed to Recovery of rounded amount
Please take the help of F1 and read the documentation -
Copying tables between schema owners
In Timesten, can you copy tables across schemas/owners?
i.e. OWNER_A.TABLE_Y to OWNER_B.TABLE_Y
Where TABLE_Y has the same definition? Basically, I'd like to be able to backup one datastore and restore it in another datastore that has the same table definitions, but may have a different owner name.
Thanks,
LarryI'm not completely clear on exactly what you are looking to do. On one hand you ask about copying tables between schemas. This is easily done:
CREATE TABLE OWNER_B.TABLE_Y AS SELECT * FROM OWNER_A.TABLE_Y;
This only works for TimesTen tables that are not part of a cache group; specifically the source table can be part of a cache group but the target table cannot. if the target table is part of a cache group then you need to:
1. Create the cache group containing the target (cached) table.
2. INSERT INTO OWNER_B.TABLE_Y SELECT * FROM OWNER_A.TABLE_Y;
But then you mention backup and restore. Since TimesTen backup/retore (ttBackup/ttRestore) works at a physical level you cannot rename/copy tables as part of that. You might be able to use ttMigrate with the -rename oldOwner:newOwner option but there are some constraints around this (one being that PL/SQL cannot be enabled in the database).
Chris -
Report query XML schema error - Apex Listener 2
I built a simple query: select * from emp in (Shared components > Report Query)
When I try to download XML schema for this query (Source Query section) resulting xsd file contains this text: String index out of range: -1
Shared Apex hosting: 4.2.2.0.0.11
Print server: Apex Listener 2.0.1Hey Saymonc, we're you ever able to find the cause of this issue? I'm having this happen to me as well. When I begin using the Report Query functionality, the schema downloaded just fine. I made an update to a query and began receiving this error. Now I get the error for ALL of my report queries. I tried removing them and recreating them, and I continue to receive this error in my schema file, no matter how simple the query. The data will download just fine, and using the Test Report button works as well.
Thanks,
Chris
Maybe you are looking for
-
Can't download DW5.5. Error with Adobe Download Assistant
I am getting error 100 with the Adobe Download Assistant (ADA). The log is below. IE can connect to https://www.adobe.com/cfusion/flex2gateway so why is ADA having problem? I wish Adobe didn't take away the direct download links. Searching the forums
-
How to add new product version in Mopz?
Hi, Can anyone guide me how to add a new product version in maintenance optimizer? I am going to get the stack file of Netweaver gateway 7.4, but without the product version, I could not proceed. Thanks in advanced.
-
Edit in Gimp with iPhoto 9.5.1
When I try to select an external program for editing photos in iPhoto 9.5.1 Photoshop show up as the only alternative. How can I select Gimp in stead? Both Photoshop and Gimp are installed in my Macbook Pro running Maverics. Br Tellef
-
icloud Backup Failed There was a problem enabling iCloud Backup
-
No value found in Personnel Officer field
Hi All, Even after creating Personnel Officer with APPL group In vacancy overview(T750X) I'm not able to store any value and getting error saying "Entry does not exist' Please guide Thanks Rakhi