Query regarding insert statement ( help me)
how to insert 10 rows at a time???
wheather it is possible??
Hi user648016!
What you are looking for is called "Multi Table Insert".
INSERT ALL
INTO sales (prod_id, cust_id, time_id, amount)
VALUES (product_id, customer_id, weekly_start_date, sales_sun)
INTO sales (prod_id, cust_id, time_id, amount)
VALUES (product_id, customer_id, weekly_start_date+1, sales_mon)
INTO sales (prod_id, cust_id, time_id, amount)
VALUES (product_id, customer_id, weekly_start_date+2, sales_tue)
INTO sales (prod_id, cust_id, time_id, amount)
VALUES (product_id, customer_id, weekly_start_date+3, sales_wed)
INTO sales (prod_id, cust_id, time_id, amount)
VALUES (product_id, customer_id, weekly_start_date+4, sales_thu)
INTO sales (prod_id, cust_id, time_id, amount)
VALUES (product_id, customer_id, weekly_start_date+5, sales_fri)
INTO sales (prod_id, cust_id, time_id, amount)
VALUES (product_id, customer_id, weekly_start_date+6, sales_sat)
SELECT product_id, customer_id, weekly_start_date, sales_sun,
sales_mon, sales_tue, sales_wed, sales_thu, sales_fri, sales_sat
FROM sales_input_table;
For more information about this look here:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#i2163698
Hope this helps!
Similar Messages
-
Select query and Insert statement performance
Hi all,
Can anyone plz guide us on below problem I am facing ?
1) One of the simple Insert statement runs very slow..What might be the reason? Its simple table without any LOBs ,LONG or so. Everything else in the DB works fine.
2) one of the SELECT statement runs very slow. It selects all records (around 1000) from a table..How can i improve its performance?
3)Which columns in the Master and its detail tables should be indexed to improve Query performance on them.
Many Thanks
Regards
sandeepTo get an answer to your questions you have to post some informations about your system:
1. operating system
2. RAM
3. oracle version
4. init.ora
Thomas -
B1out - B1isql - Pass value of query to insert statement.
Experts,
Perhaps it is because it is late and I am very tired, but I feel as though I am overlooking some obvious solution to the following scenario.
I have created a scenario that is making a SQL Call to a database, and I need to pass the values from that query to a table in a B1 DB.
I am using an outbound channel of B1, and the B1isql type.
here is my issue,
I know that I can pass the value of atom0 JDBC:JOBID to my Field tag.
However, the insert statement uses the tag attribute value="" to pass the values to the DB.
<Table id="invoicesource" keylist="jobid" task="A" del="">
<Field id="JOBID" value="" wrapchar="False"><xsl:value-of select="jdbc:JOBID"/></Field>
</Table>
I'd like to be able to pass the <value-of select= />, into the value="" attribute instead.
Any insight would be greatly appreciated.
warmest regards,
Lucas FischerI used standard SQL out instead, since it was for custom DB object, and not SAP B1 table, issue resolved.
Edited by: Lucas Fischer on Jun 28, 2011 12:01 PM -
SQL insert statement help please
alternative is to have the table with field dateadd with default value of getdate() - then do not include in your insert statement - then the modify date use and update - starting point - my two cetns
Hi all I'm trying to go a little out of my comfort level here and was hoping for some advice. I have a sql table that has 2 date fields. an add and a modified. If the modified date is null then I want to calculate on the date added. Otherwise I'd like to calculate on the modified date.
Here is a simplified version of what I'm trying to accomplish.
Hope it makes sense what I'm trying to do.
SQLSELECT field1,field2.... ,dateAdded , dateModifiedINTO tblOutputFROM tblInput/* some pseudo code here */WHERE (if dateModified not null then ( dateModified -
Query in Insert statement with JDBC Rx adapter
Hi,
This is a FILE to JDBC scenario.
My target datatype is like this with sample payload values
statement_s
statement_s
action='INSERT"
access
A=1234
B=1002
key
A=1234
B ="10%"
compareOperation= LIKE
A(1..1) is primary key in DB and B(0..1) colunm is an optional one.
I want to know if such kind of Insert query with(LIKE operator) is possible.
Please reply me ASAP.
Edited by: ram pranav on Feb 18, 2009 10:28 PMHi Ram,
IN case of "UPDATE_INSERT", you can use the KEY tag in your structure. Also you can provide LIKE as an attribute to the KEY element as follows :
<key1>
<col4 compareOperation=u201DLIKEu201D>val%</col4>
</key1>
But when you are trying to insert the data_, the <key> tags will be ignored and only <access> will be considered._
action=UPDATE_INSERT
The statement has the same format as for the UPDATE action. Initially, the same action is executed as for UPDATE. If no update to the database table can be made for this action (the condition does not apply to any table entry), values of the table described in the <access> element are inserted in accordance with the description of the action INSERT. <key> elements are ignored in this case.
The response document has the following format; one of the two values is always 0 because either an UPDATE or an INSERT action is always executed:
Go through the link I have provided earlier.
Thanks,
Pooja Pandey -
Query regarding inserting a new row at first row data table
hi all,
I have a doubt regarding the insertion of new row in data table.I am now using the following code
if (skillDataProvider.canAppendRow()){
RowKey rowkey = skillDataProvider.appendRow();
skillDataProvider.setCursorRow(rowkey);
String skillID=getSkilID();
skillDataProvider.setValue("Skill.SkillID", rowkey, skillID);
int rowID=Integer.parseInt(rowkey.getRowId());
tableRowGroup1.setFirst(rowID);
Its working fine.But this code gives me provision to add the data at the last of the table.I need it to be at the first row.I tried
RowKey rowkey=skillDataProvider.insertRow(skillDataProvider.getRowKey(String.valueOf(0)));
but it shows some null pointer exception.Can anyone help me?
Thanks in advance
SreeI think AChervov has the right idea here.
CachedRowSetDataProvider.canInsertRow(beforeRow) returns false, so you cannot insertRow().
Therefore, you'll need to control the sort order yourself. I'd add a sort field to the database. Then use TableRowGroup.setSortCrtieria() to control the table display order. Or commit the append to the database immediately and reselect (refresh) the provider (assuming the provider has the desired "order by"). -
Query regarding Concatenate statement functionality from ECC 6.0 to 46B ver
Hi,
I got new requirement ie I have to copy reports from ECC6.0 to 46B version. While copying I faced number of issues and I am not clear for below one.
concatenate i_result1-result p_delim into i_result1-result respecting blanks. ( this is in ECC6.0)
now my requirement is I have to use the same functionality in 46B version without respecting blanks the statement is working but I need the functinality of respecting blanks also.
Thanks in advance.
-Kumar.Try like this in 46B:
concatenate i_result1-result p_delim into i_result1-result SEPARATED BY SPACE.
Regards,
Naimesh Patel -
Query regarding EJB -QL --- Help me out
Hello, i have a basic question regarding QL
as such if we want findBYxxx() we provide a similar query in QL descriptor, this is ok..
but the problem is..
how can i proceed with query that retrieves rows from multiple tables (referential integrity)..
suppose i call retrieveRows() menthod on entity (cmp) from my view (jsp), then what code i have to write in retrieveRows() method of bean (cmp entity). and what has to be specified in the QL deploment Descriptor.
Please guide me with an example code (if possible) plzzzzz..
Thanks jaagyThis is an example of relation Street -> Town
Data-schema:
Town(
code Integer,
name String
Street(
code Integer,
name String,
town_code Interger
ejb-jar.xml fragment:
<entity>
<ejb-name>StreetBean</ejb-name>
<local-home>StreetHome</local-home>
<local>Street</local>
<ejb-class>StreetBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>host</abstract-schema-name>
<cmp-field><field-name>code</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
<primkey-field>code</primkey-field>
<query>
<query-method>
<method-name>findByTown</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[
SELECT OBJECT(s)
FROM street s
WHERE s.town.name = ?1
]]>
</ejb-ql>
</query>
</entity>
<ejb-relation>
<ejb-relation-name>Town-Street</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>town-has-streets</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>TownBean</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>townStreets</cmr-field-name>
<cmr-field-type>java.util.Set</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>street-belongs-to-town</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<cascade-delete/>
<relationship-role-source>
<ejb-name>StreetBean</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>town_code</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
</ejb-relation> -
Query regarding case statement
Hi,
I have a SP which has in_rc as an input parameter
Now I have a select query which is as follows in pseudo
select....
where <condition1>
And <condition2>
And <condition3>
Now my requirement is that I want to add one more filter based on the in_rc
ie if in_rc is not null, then I want to add one more filter condition along with the existing condition else only the existing condition.
pseudo:
select....
where <condition1>
And <condition2>
And <condition3>
case <in_rc><when not null>then
AND <condition 4>
possible?
regds,
SunI am not pedantic. Just pointing out some things to be aware of (should be allowed, shouldn't it?);)
It only requires a few more NVL's. ;) or lnnvl? ;)
michaels> VAR mgr number
michaels> EXEC :mgr := 7782
michaels> SELECT ename, mgr
FROM emp
WHERE lnnvl (mgr != :mgr)
ENAME MGR
KING /* want nulls or not? */
MILLER 7782
michaels> EXEC :mgr := NULL
michaels> SELECT ename, mgr
FROM emp
WHERE lnnvl (mgr != :mgr)
ENAME MGR
SMITH 7902
ALLEN 7698
WARD 7698
JONES 7839
MARTIN 7698
BLAKE 7839
CLARK 7839
SCOTT 7566
KING
TURNER 7698
ADAMS 7788
JAMES 7698
FORD 7566
MILLER 7782 -
Urgent help needed... PL/SQL Insert statement
Hi...
I need some urgent help on this project. I have a 2 column table with values that need to be inserted into another existing table which has a sequence.
This is the 2 column table:
FUND YEAR
29587 05
29587 07
Existing table:
Name Null? Type
LIST_ID NOT NULL NUMBER(6) -- This is a sequence
WEB_USER_ID NOT NULL VARCHAR2(10)
RESOURCE_TYPE NOT NULL VARCHAR2(8)
LIST_TYPE NOT NULL VARCHAR2(10)
LIST_NAME NOT NULL VARCHAR2(50)
LIST_CODE_1 NOT NULL VARCHAR2(6) -- FUND from table above
LIST_CODE_2 NOT NULL VARCHAR2(6) -- YEAR from table above
LIST_CODE_3 NOT NULL VARCHAR2(6)
LAST_UPDATED_DT NOT NULL DATE
LAST_UPDATED_BY NOT NULL VARCHAR2(10)
LIST_CODE_4 NOT NULL VARCHAR2(20)
The columns from table 1 (FUND, YEAR) correspond to columns (LIST_CODE_1, LIST_CODE_2) in table 2. The column LIST_ID is a sequence. I can put in sysdate for LAST_UPDATED_DT and my initials SN for LAST_UPDATED_BY. This is going to be for 2 unique WEB_USER_IDs which would be in the WHERE clause. I will be inserting 2200 rows for each id. A single insert statement would look like this -
INSERT INTO EXISTING_TBL (list_id,web_user_id,resource_type,list_type,list_name,list_code_1,list_code_2,list_code_3,list_code_4,last_updated_dt,last_updated_by) VALUES ('470027','WEBUSER','GL','FUNDFYF',' FUND BALANCE SUM','12010','01',' ',' ',{ts '2010-5-19 10:16:9'},'SN')
How would I do this to insert the 2200 values from my 2 column table to the existing table?
All help is greatly appreciated!!
SNHello ,
I think this will work
INSERT INTO TABLE2
LIST_ID,
WEB_USER_ID,
RESOURCE_TYPE,
LIST_TYPE,
LIST_NAME,
LIST_CODE_1,
LIST_CODE_2,
LIST_CODE_3,
LIST_CODE_4,
LAST_UPDATED_DT,
LAST_UPDATED_BY
SELECT
SEQ.NEXTVAL,
FUND,
YEAR,
<VALUE FOR RESOURCE_TYPE>,
<VALUE FOR LIST_TYPE>,
<VALUE FOR LIST_NAME>,
<VALUE FOR LIST_CODE_1>,
<VALUE FOR LIST_CODE_2>,
<VALUE FOR LIST_CODE_3>,
<VALUE FOR LIST_CODE_4>,
SYSDATE,
'SN'
FROM
TABLE1
REGARDS
Rahul Sharma -
Using insert statements for creating objects..pls help
Hello all,
I have 2 databases DB1 (which is running on 8i) and DB2( Running on 10G).
How can I copy all the objects of a particular schema (user1) from DB1 to DB2, only by using INSERT statements. I do not want to use import/export since it is taking huge time for the operation.
Could anybody help me on this?
Regards,
chotuSince I have allready imported indexes,procedures etc , now I need only to copy tables from DB1 to DB2.
I have truncated all the tables of user1 in DB2
Now I am using,
insert into my_tab as select * from user1.my_tab@DB2_db_link;
Thanks for the help...
chotu. -
Help needed in forming dynamic insert statement
HI,
I am trying to construct a insert statement as given below.
Please help me as to how to form this and where am i going wrong?
i want the columns names to be auto populated when a table name is given.
output should be like:
==============
insert into tablename
col1,col2,col3..coln)
values
(col1, col2, col3..coln);
declare
v_sql varchar2(5000);
cnt number :=0;
col_count number;
name varchar2(5000);
TYPE string_assarrtype IS TABLE OF VARCHAR2 ( 25 ) INDEX BY VARCHAR2 ( 20 );
arr string_assarrtype;
BEGIN
select count(column_name) into col_count from user_tab_columns
where
table_name = 'PS_D_RE_BCSREGIONMAPPING';
v_sql:='insert into tablename (' ;
for i in 1..arr(col_count)
loop
v_sql:='v_sql' ||' '||arr(i);
DBMS_OUTPUT.PUT_lINE(v_sql);
END LOOP;
END;Below is the actual code which i am trying to write:
Since the below trigger logic is same for around 25/30 tables i wanted to construct a generic procedure which will take input parameter as tablename and auit_table and form the insert statement which will populate the column names which are different for different tables.
Please guide...
CREATE OR REPLACE PROCEDURE make_trigger( tablename in VARCHAR2,
auditable in VARCHAR2
AS
v_sql varchar(10000);
begin
v_sql := 'DROP TRIGGER TRD_D_AUDIT_D'||tablename;
dbms_output.put_line (v_sql );
v_sql:='CREATE OR REPLACE TRIGGER TRG_D_AUDIT_D_'||tablename||' '||
'BEFORE INSERT OR UPDATE OR DELETE ON 'tablename||' '||' REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW';
dbms_output.put_line (v_sql );
v_sql:= 'DISABLE
DECLARE
v_Operator psoprdefn.oprid%type;
v_Sysdate Date;
v_Actn varchar2(1);
V_AUDIT_RECNAME PSRECDEFN.RECNAME%type;
BEGIN';
dbms_output.put_line (v_sql );
v_sql:= 'If (Inserting) Then
v_Actn :='||'''||'A'||'''||';'||
'Insert into '||auditable||'
('||
AUDIT_RECNAME,
AUDIT_ACTN,
AUDIT_OPRID,
AUDIT_STAMP,
D_USER_GROUP,
D_GROUP_DESC,
D_BCS_ID,
D_UBR_ID,
D_FILTER_ID,
D_NAME_ACCESS_TYPE,
D_GLOBAL_EMP_LIST
Values
V_AUDIT_RECNAME,
v_Actn,
v_Operator,
v_Sysdate,
:NEW.D_USER_GROUP,
:NEW.D_GROUP_DESC,
:NEW.D_BCS_ID,
:NEW.D_UBR_ID,
:NEW.D_FILTER_ID,
:NEW.D_NAME_ACCESS_TYPE,
:NEW.D_GLOBAL_EMP_LIST
end if;
end;Edited by: user11942774 on Oct 5, 2012 11:46 AM
Edited by: user11942774 on Oct 5, 2012 8:09 PM
Edited by: user11942774 on Oct 5, 2012 8:10 PM -
Query returning different number of rows standalone vs insert statement
Hi,
We are using Oracle 10g. We are facing a issue where a SELECT inserts 26294 rows when used with a insert statement. The same select (cut-and-paste) when executed standalone, returns only 60 rows. Any idea what could be causing this?
Thanks in advance,
Hari Narayanan
TIAA-CREF
See details below,
SQL> INSERT INTO cref.position_recon_breaks (
2 effective_date,
3 fund_entity_id,
4 security_alias,
5 accounting_system,
6 pace_shares,
7 accounting_sys_shares,
8 accounting_sys_unp_trd_shares
9 )
10 SELECT pr.effective_date,
11 pr.ENTITY_ID,
12 pr.SECURITY_ALIAS,
13 'MELLON',
14 CREF_SHARES PACE_SHARES,
15 CORP_SHARES ACCOUNTING_SYS_SHARES,
16 CORP_UNP_TRD_SHARES ACCOUNTING_SYS_UNP_TRD_SHARES
17 FROM cref.MELLON_POSITION_RECON pr
18 WHERE ABS(SHARES_DIFFERENCE) >= 1;
25294 rows created.
SQL> select count(*) from
2 (SELECT pr.effective_date,
3 pr.ENTITY_ID,
4 pr.SECURITY_ALIAS,
5 'MELLON',
6 CREF_SHARES PACE_SHARES,
7 CORP_SHARES ACCOUNTING_SYS_SHARES,
8 CORP_UNP_TRD_SHARES ACCOUNTING_SYS_UNP_TRD_SHARES
9 FROM cref.MELLON_POSITION_RECON pr
10 WHERE ABS(SHARES_DIFFERENCE) >= 1);
COUNT(*)
60charred/jzhang,
Thanks for your responses. Just as an additional info, MELLON_POSITION_RECON is one hell of a view - not written by me :) - with unions and inline queries.
If it would be of any help, here is the script,
CREATE OR REPLACE FORCE VIEW CREF.MELLON_POSITION_RECON
(EFFECTIVE_DATE, FUND_CODE, ENTITY_ID, ENTITY_NAME, SECURITY_ALIAS,
SECURITY_NAME, PRIMARY_ASSET_ID, CREF_SECURITY_COUNT, CORP_SECURITY_COUNT, CREF_CURRENCY_CODE,
CORP_CURRENCY_CODE, CREF_EXCHANGE_RATE, CORP_EXCHANGE_RATE, CREF_SHARES, CORP_SHARES,
CREF_PRICE_LOCAL, CORP_PRICE_LOCAL, CREF_MARKET_VALUE_USD, CORP_MARKET_VALUE_USD, CREF_MARKET_VALUE_LOCAL,
CORP_MARKET_VALUE_LOCAL, CREF_ACCRUED_INCOME_USD, CORP_ACCRUED_INCOME_USD, CORP_UNP_TRD_MARKET_VALUE, CORP_UNP_TRD_SHARES,
SHARES_DIFFERENCE, SHARES_DIFF_INCL_UNP, LOCAL_PRICE_DIFFERENCE, MKT_VALUE_USD_DIFF, MKT_VALUE_USD_DIFF_INCL_UNP,
ACCRUED_INCOME_DIFF)
AS
SELECT /*+ ORDERED */
P.EFFECTIVE_DATE
,E.CODE FUND_CODE
,P.ENTITY_ID
,E.LONG_NAME ENTITY_NAME
,P.SECURITY_ALIAS
,S.ISSUE_NAME SECURITY_NAME
,S.PRIMARY_ASSET_ID
,P.CREF_SECURITY_COUNT
,P.CORP_SECURITY_COUNT CORP_SECURITY_COUNT
,P.CREF_CURRENCY_CODE
,P.CORP_CURRENCY_CODE CORP_CURRENCY_CODE
,P.CREF_EXCHANGE_RATE
,P.CORP_EXCHANGE_RATE CORP_EXCHANGE_RATE
,P.CREF_SHARES
,P.CORP_SHARES CORP_SHARES
,P.CREF_PRICE_LOCAL
,P.CORP_PRICE_LOCAL CORP_PRICE_LOCAL
,ROUND(P.CREF_MARKET_VALUE_USD,2) CREF_MARKET_VALUE_USD
,P.CORP_MARKET_VALUE_USD CORP_MARKET_VALUE_USD
,ROUND(P.CREF_MARKET_VALUE_LOCAL,2) CREF_MARKET_VALUE_LOCAL
,P.CORP_MARKET_VALUE_LOCAL CORP_MARKET_VALUE_LOCAL
,ROUND(P.CREF_ACCRUED_INCOME_USD,2) CREF_ACCRUED_INCOME_USD
,P.CORP_ACCRUED_INCOME_USD
,P.CORP_UNP_TRD_MARKET_VALUE
,P.CORP_UNP_TRD_SHARES
,NVL(P.CORP_SHARES, 0) - NVL(P.CREF_SHARES, 0) SHARES_DIFFERENCE
,NVL(P.CORP_SHARES,0) +
(NVL(P.CORP_UNP_TRD_SHARES, 0) - NVL(P.CREF_SHARES, 0)) SHARES_DIFF_INCL_UNP
,NVL(P.CREF_PRICE_LOCAL, 0) - NVL(P.CORP_PRICE_LOCAL, 0) LOCAL_PRICE_DIFFERENCE
,NVL(ROUND(P.CREF_MARKET_VALUE_USD,2),0) - NVL(P.CORP_MARKET_VALUE_USD,0) MKT_VALUE_USD_DIFF
,NVL(ROUND(P.CREF_MARKET_VALUE_USD,2),0) -
(NVL(P.CORP_MARKET_VALUE_USD, 0) + NVL(P.CORP_UNP_TRD_MARKET_VALUE,0)) MKT_VALUE_USD_DIFF_INCL_UNP
,NVL(ROUND(P.CREF_ACCRUED_INCOME_USD,2),0) - NVL(P.CORP_ACCRUED_INCOME_USD, 0) ACCRUED_INCOME_DIFF
FROM
SELECT ENTITY_ID
,EFFECTIVE_DATE
,SECURITY_ALIAS
,SUM(CREF_SECURITY_COUNT) CREF_SECURITY_COUNT
,SUM(CORP_SECURITY_COUNT) CORP_SECURITY_COUNT
,MAX(CREF_CURRENCY_CODE) CREF_CURRENCY_CODE
,MAX(CORP_CURRENCY_CODE) CORP_CURRENCY_CODE
,MAX(CREF_EXCHANGE_RATE) CREF_EXCHANGE_RATE
,MAX(CORP_EXCHANGE_RATE) CORP_EXCHANGE_RATE
,SUM(CREF_SHARES) CREF_SHARES
,SUM(CORP_SHARES) CORP_SHARES
,MAX(CREF_PRICE_LOCAL) CREF_PRICE_LOCAL
,MAX(CORP_PRICE_LOCAL) CORP_PRICE_LOCAL
,SUM(CREF_MARKET_VALUE_USD) CREF_MARKET_VALUE_USD
,SUM(CORP_MARKET_VALUE_USD) CORP_MARKET_VALUE_USD
,SUM(CREF_MARKET_VALUE_LOCAL) CREF_MARKET_VALUE_LOCAL
,SUM(CORP_MARKET_VALUE_LOCAL) CORP_MARKET_VALUE_LOCAL
,SUM(CREF_ACCRUED_INCOME_USD) CREF_ACCRUED_INCOME_USD
,SUM(CORP_ACCRUED_INCOME_USD) CORP_ACCRUED_INCOME_USD
,MIN(QUERY_TIMESTAMP) QUERY_TIMESTAMP
,SUM(CORP_UNP_TRD_MARKET_VALUE) CORP_UNP_TRD_MARKET_VALUE
,SUM(CORP_UNP_TRD_SHARES) CORP_UNP_TRD_SHARES
FROM
SELECT -- WANT ONE ROW PER FUND PER SECURITY
/*+ index(p I_POS_ENTID_SRCINTFC_CREF) index (pd) */
E.FUND_ENTITY_ID ENTITY_ID
,P.EFFECTIVE_DATE
,PD.SECURITY_ALIAS
,SYSDATE QUERY_TIMESTAMP
,1 CREF_SECURITY_COUNT
,MAX(PD.LOCAL_CURRENCY) CREF_CURRENCY_CODE
,MAX(PD.MKT_EXCHANGE_RATE) CREF_EXCHANGE_RATE
,SUM(PD.SHARE_PAR_VALUE) CREF_SHARES
,MAX(PD.PRICE) CREF_PRICE_LOCAL
,SUM(PD.MARKET_VALUE) CREF_MARKET_VALUE_USD
,SUM(PD.LOCAL_MARKET_VALUE) CREF_MARKET_VALUE_LOCAL
,SUM(PD.ACCRUED_INCOME) CREF_ACCRUED_INCOME_USD
,0 CORP_SECURITY_COUNT
,TO_CHAR(NULL) CORP_CURRENCY_CODE
,0 CORP_SHARES
,TO_NUMBER(NULL) CORP_PRICE_LOCAL
,TO_NUMBER(NULL) CORP_EXCHANGE_RATE
,0 CORP_MARKET_VALUE_USD
,0 CORP_MARKET_VALUE_LOCAL
,0 CORP_ACCRUED_INCOME_USD
,0 CORP_UNP_TRD_MARKET_VALUE
,0 CORP_UNP_TRD_SHARES
FROM CREF.ENTITY E,
CREF.ENTITY EF fund entity NF
,HOLDINGDBO.POSITION P
,(SELECT MAX(EFFECTIVE_DATE) CURRENT_DATE
FROM HOLDINGDBO.POSITION P,
PACE_MASTERDBO.INTERFACES I
WHERE I.SHORT_DESC = 'MELLON'
AND I.INSTANCE = P.SRC_INTFC_INST) DT
,HOLDINGDBO.POSITION_DETAIL PD
,PACE_MASTERDBO.INTERFACES I
WHERE E.PORTFOLIO_ENTITY_TYPE_CODE = 'PORT'
AND E.ENTITY_ID = P.ENTITY_ID
AND EF.ENTITY_ID = E.FUND_ENTITY_ID -- NF
AND EF.ACCOUNTING_SYSTEM = 'MELLON' -- NF
AND E.ENTITY_ID = P.ENTITY_ID
AND I.SHORT_DESC = 'STARDIRECT'
AND I.INSTANCE = P.SRC_INTFC_INST
AND P.EFFECTIVE_DATE = DT.CURRENT_DATE
AND P.POSITION_ID = PD.POSITION_ID
-- "GROUP BY" COMBINES THE LONG AND SHORT POSITIONS
GROUP BY P.EFFECTIVE_DATE, E.FUND_ENTITY_ID, PD.SECURITY_ALIAS
UNION ALL
SELECT -- CORPORATE SENDS ONE ROW PER FUND PER SECURITY (NO SHORTS)
/*+ index(p I_POS_ENTID_SRCINTFC_CREF) index (pd) */
E.ENTITY_ID
,P.EFFECTIVE_DATE
,PD.SECURITY_ALIAS
,SYSDATE QUERY_TIMESTAMP
,0 CREF_SECURITY_COUNT
,TO_CHAR(NULL) CREF_CURRENCY_CODE
,0 CREF_SHARES
,TO_NUMBER(NULL) CREF_PRICE_LOCAL
,TO_NUMBER(NULL) CREF_EXCHANGE_RATE
,0 CREF_MARKET_VALUE_USD
,0 CREF_MARKET_VALUE_LOCAL
,0 CREF_ACCRUED_INCOME_USD
,1 CORP_SECURITY_COUNT
,PD.LOCAL_CURRENCY CORP_CURRENCY_CODE
,PD.SHARE_PAR_VALUE CORP_SHARES
,PD.PRICE CORP_PRICE_LOCAL
,pd.mkt_exchange_rate CORP_EXCHANGE_RATE
,PD.MARKET_VALUE CORP_MARKET_VALUE_USD
,PD.LOCAL_MARKET_VALUE CORP_MARKET_VALUE_LOCAL
,PD.ACCRUED_INCOME CORP_ACCRUED_INCOME_USD
,0 CORP_UNP_TRD_MARKET_VALUE
,0 CORP_UNP_TRD_SHARES
FROM CREF.ENTITY E
,HOLDINGDBO.POSITION P
,(SELECT MAX(EFFECTIVE_DATE) CURRENT_DATE
FROM HOLDINGDBO.POSITION P,
PACE_MASTERDBO.INTERFACES I
WHERE I.SHORT_DESC = 'MELLON'
AND I.INSTANCE = P.SRC_INTFC_INST) DT
,HOLDINGDBO.POSITION_DETAIL PD
,PACE_MASTERDBO.INTERFACES I
WHERE E.FUND_FLAG = 'Y' --
AND E.ENTITY_ID = P.ENTITY_ID
AND I.SHORT_DESC = 'MELLON'
AND I.INSTANCE = P.SRC_INTFC_INST
AND P.EFFECTIVE_DATE = DT.CURRENT_DATE
AND P.POSITION_ID = PD.POSITION_ID
UNION ALL
SELECT
UTS.FUND_ENTITY_ID ENTITY_ID
,UTS.EFFECTIVE_DATE
,UTS.SECURITY_ALIAS
,SYSDATE QUERY_TIMESTAMP
,0 CREF_SECURITY_COUNT
,TO_CHAR(NULL) CREF_CURRENCY_CODE
,0 CREF_SHARES
,TO_NUMBER(NULL) CREF_PRICE_LOCAL
,TO_NUMBER(NULL) CREF_EXCHANGE_RATE
,0 CREF_MARKET_VALUE_USD
,0 CREF_MARKET_VALUE_LOCAL
,0 CREF_ACCRUED_INCOME_USD
,0 CORP_SECURITY_COUNT
,TO_CHAR(NULL) CORP_CURRENCY_CODE
,0 CORP_SHARES
,TO_NUMBER(NULL) CORP_PRICE_LOCAL
,TO_NUMBER(NULL) CORP_EXCHANGE_RATE
,0 CORP_MARKET_VALUE_USD
,0 CORP_MARKET_VALUE_LOCAL
,0 CORP_ACCRUED_INCOME_USD
,UTS.SUM_MARKET_VALUE CORP_UNP_TRD_MARKET_VALUE
,UTS.SUM_SHARES CORP_UNP_TRD_SHARES
FROM
(SELECT MAX(EFFECTIVE_DATE) CURRENT_DATE
FROM HOLDINGDBO.POSITION P,
PACE_MASTERDBO.INTERFACES I
WHERE I.SHORT_DESC = 'MELLON'
AND I.INSTANCE = P.SRC_INTFC_INST) DT
,cref.UNPROCESSED_TRADES_SUM UTS
WHERE DT.CURRENT_DATE = UTS.EFFECTIVE_DATE
AND UTS.UPDATED_BY = 'MELLON'
GROUP BY EFFECTIVE_DATE, ENTITY_ID, SECURITY_ALIAS
) P,
cref.ENTITY E,
SECURITYDBO.SECMASTER_HISTORY S
WHERE P.ENTITY_ID = E.ENTITY_ID
AND P.SECURITY_ALIAS = S.SECURITY_ALIAS
AND S.SRC_INTFC_INST = (SELECT INSTANCE FROM PACE_MASTERDBO.INTERFACES
WHERE SHORT_DESC = 'EAGLE PACE')
AND S.EFFECTIVE_DATE = (SELECT MAX(S1.EFFECTIVE_DATE)
FROM SECURITYDBO.SECMASTER_HISTORY S1
WHERE S1.SRC_INTFC_INST = S.SRC_INTFC_INST
AND S1.SECURITY_ALIAS = S.SECURITY_ALIAS
AND S1.EFFECTIVE_DATE <= P.EFFECTIVE_DATE); -
Looking for some help with building insert statements...
Hi, I am using some sql to build some insert statements for me to update a set of tables in our qa environments. The scripts that I have created were working great until someone added a column to some of the tables in the qa env which in turn makes my scripts break because I was simply building the statment to do someting like this...
insert into dest_table (select * from source_table@dblink);
But now when the coumns in the tables do not match it breaks...
This is the dynamic create script I use, can anyone help or suggest a better way to be able to build update statements update to qa tables when the columns are mismatched?
spool insert.sql
select
'insert into ' || table_name || ' (select * from ' || table_name || '@prod );' || chr(10) || ' commit;'
from user_tables
where table_name in
(select * from refresh_tablesl)
any help is greatly appreciated,
Thanks.See my reply to your duplicate post
looking for help building dynamic insert statements... -
Hi i am new to SCN. I want a help regards SAP-PM . Where to post any query regards SAP PM
Please check this link SAP Portfolio and Project Management (SAP RPM, cProjects) and cFolders
Please check scn index to find relevant forum link.
SCN Site Index
Maybe you are looking for
-
Linksys E1200 No Longer Working After Verizon Modem Replacement
I have a new Linksys E2100 that was working well with an old Verizon modem. Then recently that modem gave up the ghost and I was issued another one (Westel Model 6100G). I have no problems with internet connectivity when connecting directly from my h
-
Best setting for 3D content for Flash
Hello all. I am a Premiere noob that works in Cinema 4D. I am exporting C4D animations as QuickTime "animation" files. (.mov) These videos are highly detailed pixel-precise renders. I want to bring them into Premier with this level of pixel prec
-
How to pass variables between 2 jsp pages-help
Hi, I have a question like this. As an example consider I have 3 .jsp pages. page1.jsp - In this html form it has some textboxes to enter employee details. page2.jsp - In this page it has a "PRINT" button which allows the user to click. page3.jsp - A
-
Transfering movies from iPad to computer
Hello guys, I have recorded a lecture in my school with 1h and half,so it probably have around 11685mb. I am trying to pass this really big video to my computer (Sony VAIO) but I can't find the video anywhere in the folder,but inside de iPad it is am
-
Deploying crystal reports on a website...
Post Author: cusimar9 CA Forum: General We're trying to integrate Crystal Reports into one of our .NET websites and we're having some difficulty. I've tried to build the website using the 'merge modules' but to no avail. Does our host have to have Cr