Best way to create a table based on another table
Hello,
I am trying to create a table based on another table with all the data in it. It has large data.
create table <tablename> as select * from table1.
Is this the best way of doing it or is there any other way. please advice.
thanks
I am suggested to create new table as
create table <newtable> as
select * from <oldtable> where rownum < 1;
then
alter table <newtable> compress;
then
insert /*+ append */ into <newtable> as select * from <oldtable>;
but i getting an error saying missing values key words ora- 00926.
please advice
Similar Messages
-
How to update one table based on another table ??
Hello Friends:
I am trying to run the following query in oracle but it won't run.
UPDATE BOYS
SET
BOYS.AGE = GIRLS.AGE
FROM GIRLS
WHERE
BOYS.FIRSTNAME = GIRLS.FIRSTNAME AND
BOYS.LASTNAME = GIRLS.LASTNAME;
This query runs fine in sql server but in oracle its saying can't find "SET". PLease tell me what is the correct syntax in oracle to update one table based on another table.
thanksSee if this helps.
If you wrote an SQL statement:
update boys set age = 10;
Every row in the boys table will get updated with an age of 10. But if you wrote:
update boys set age = 10
where firstname = 'Joe';
Then only the rows where the firstname is Joe would be updated with an age of 10.
Now replace the 10 in the above statements with (select g.age from girls g where g.firstname = b.firstname and g.lastname = b.lastname) and replace where firstname = 'Joe' in the second statement with where exists (select null from girls g where g.firstname = b.firstname and g.lastname = b.lastname). The same concepts apply whether 10 is an actual value or a query and whether you have a where clause with the update statement to limit rows being updated.
About the select null question regarding the outer where clause:
Since the query is checking to see if the row in the girls table exists in the boys table what the column is in this select statement doesn't matter, this column isn't being used anywhere. In this case Todd chose to use null. He could have also used a column name from the table or a lot of times you'll see the literal value 1 used here. -
What is the best way, while creating Function Module based extractor
Hi Friends,
I am Sreekanth.
I have created a Functio Module based Extractor,
To fetch data from COPA tables.
In this extracton 3 tables are getting involved.
1) CE3OP01 2) CE4OP01 and 3) CE1OP01.
Logic required is as follow:
1) get data from CE3OP01 and for all entries of this data set,
get data from CE4OP01 and CE1OP01 and finally send the data set to BW after few manupulations.
I have implemented the whole logic and its working fine in DEVELOPMENT box where data volume is less.
But the same code is timing out in Quality Box, due to huge volues of data.
Below I am copying the code that i am using . Any body can suggest me how to proceed further so that my code works with huge volumes of data.
Now I am getting the time out error while selection data from CE3IOP01 table itself.
FUNCTION /ds1/c_bw_zds_copa_recon.
""Local interface:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR
*" VALUE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*" VALUE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*" TABLES
*" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*" E_T_DATA STRUCTURE /DS1/FI_COPA_RECN OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
PROGRAM INFORMATION *
RIEF ID.......: N/A *
PROGRAM.......: /DS1/C_BW_ZDS_COPA_RECON
PROGRAM FUNCTION: This Function Module Extracts Cost Center, Company *
Code, and all Amount fields form CE3OP01 table and sectaktbo "
* Current profitability segment (CO-PA) *
paobjnr " Profitability Segment Number (CO-PA) *
pasubnr " Profitability segment changes (CO-PA) *
bukrs " Company Code
kndnr " Customer from CE4Op01 table. *
Segrigate one record from CE3Op01 into 93 based on Value fields. *
PROGRAM TYPE..Function Module *
DEV. CLASS..../DS1/MI_01 *
LOGICAL DB.... N/A *
Conventions used in the Program *
* global variables --> g_* *
* local variables --> l_* *
* constants --> c_* *
* internal tables --> t_* *
* structures --> x_* *
* parameters --> p_* *
* select-options --> s_* *
* ranges --> r_* *
* workarea --> w_* *
* field symbol --> fs_* *
Declaration for Interface: Selection criteria
STATICS: s_s_if TYPE srsc_s_if_simple,
Maximum number of lines for DB table
ls_s_if TYPE srsc_s_if_simple, "Static Structure
counter
ls_counter_datapakid LIKE sy-tabix,"Static Counter
cursor
ls_cursor TYPE cursor,"Static Cursor.
ls_cursor1 TYPE cursor."Static Cursor.
*CONSTANTS
CONSTANTS: lc_datasource TYPE char14 VALUE 'ZDS_COPA_RECON',
" Data Source Name
lc_msgtype TYPE char1 VALUE 'E', "message type
lc_msgcls TYPE char2 VALUE 'R3', "message class
lc_msgnum TYPE char3 VALUE '009',"Message Number.
lc_001 TYPE char3 VALUE '001',
lc_b0 TYPE char2 VALUE 'B0',
lc_10 TYPE char2 VALUE '10',
lc_01 TYPE char2 VALUE '01',
lc_02 TYPE char2 VALUE '02',
lc_1 TYPE sy-tabix VALUE 1.
*Data Declaration.
DATA: lt_ce3op01 TYPE STANDARD TABLE OF x_ce3op01,
" Internal table for ce3op01
lt_ce3op02 TYPE STANDARD TABLE OF x_ce3op01,
lt_ce4op01 TYPE STANDARD TABLE OF x_ce4op01,
" Internal table for ce4op01
lw_ce3op01 TYPE x_ce3op01,
" Work area for ce3op01
lw_ce3op02 TYPE x_ce3op01, "MOD-002
lw_ce4op01 TYPE x_ce4op01,
" Work area for ce4op01
lw_e_t_data TYPE /ds1/fi_copa_recn,
" Work area for /ds1/fi_copa_recn.
*CE1op01
lt_ce1op01 TYPE STANDARD TABLE OF x_ce1op01,"Internaltable
lw_ce1op01 TYPE x_ce1op01,"Work area for CE1op01.
**CE1op01
lt_fldlist TYPE STANDARD TABLE OF lx_fldlist, "fields list
lw_fldlist TYPE lx_fldlist," FIELDS list work area
lt_flnmval TYPE STANDARD TABLE OF lx_flnmval,"table for splitting
lw_flnmval TYPE lx_flnmval,"work area for spilitting
l_index TYPE i VALUE 1, "to keep track of index.
l_len TYPE i,
l_s_no_recs TYPE sy-tabix VALUE 99,
l_s_loop_from TYPE sy-tabix, "from "MOD-002
l_s_loop_to TYPE sy-tabix, "to"MOD-002
l_norecs TYPE sy-tabix, "MOD-002
l_count TYPE sy-tabix. "MOD-002
*Field Symbols.
FIELD-SYMBOLS:
<fs_flnmval> TYPE lx_flnmval."Field symbol for fild values
Selection Ranges
RANGES: lr_bukrs FOR ce4op01-bukrs, " Range for company code
lr_versi FOR ce3op01-versi," Range for version
lr_paledger FOR ce3op01-paledger,"Range for paledger
lr_vrgar FOR ce3op01-vrgar,"Range for vrgar
lr_gjahr FOR ce3op01-gjahr,"Range for Fiscal year
lr_perbl FOR ce3op01-perbl."Range for perbl
Initialization mode (first call by SAPI) or data transfer mode
IF i_initflag = sbiwa_c_flag_on.
Initialization: check input parameters
buffer input parameters
prepare data selection
Check DataSource validity
IF ls_counter_datapakid = 0.
CASE i_dsource.
WHEN lc_datasource.
WHEN OTHERS.
IF 1 = 2. MESSAGE e009(r3). ENDIF. "#EC *
this is a typical log call. Please write every error message like this
log_write lc_msgtype "'E' "message type
lc_msgcls "'R3' "message class
lc_msgnum "'009' "message number
i_dsource "message variable 1
' '. "message variable 2
RAISE error_passed_to_mess_handler.
ENDCASE.
APPEND LINES OF i_t_select TO s_s_if-t_select.
APPEND LINES OF i_t_fields TO s_s_if-t_fields.
Fill parameter buffer for data extraction calls
ls_s_if-requnr = i_requnr.
ls_s_if-dsource = i_dsource.
ls_s_if-maxsize = i_maxsize.
ls_s_if-initflag = i_initflag.
Company Code
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_bukrs.
MOVE: i_t_select-sign TO lr_bukrs-sign,
i_t_select-option TO lr_bukrs-option,
i_t_select-low TO lr_bukrs-low,
i_t_select-high TO lr_bukrs-high.
APPEND lr_bukrs.
ENDLOOP.
*Version (0)
*SRSC_S_IF_SIMPLE-T_SELECT
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_versi.
LOOP AT i_t_select INTO s_s_if-t_select WHERE fieldnm = c_versi.
MOVE: i_t_select-sign TO lr_versi-sign,
i_t_select-option TO lr_versi-option,
i_t_select-low TO lr_versi-low,
i_t_select-high TO lr_versi-high.
APPEND lr_versi.
ENDLOOP.
*Currency Type (company code only)
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_paledger.
MOVE: i_t_select-sign TO lr_paledger-sign,
i_t_select-option TO lr_paledger-option.
IF i_t_select-low = lc_b0.
MOVE lc_01 TO lr_paledger-low.
ELSEIF i_t_select-low = lc_10.
MOVE lc_02 TO lr_paledger-low.
ENDIF.
APPEND lr_paledger.
ENDLOOP.
*Record Type
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_vrgar.
MOVE: i_t_select-sign TO lr_vrgar-sign,
i_t_select-option TO lr_vrgar-option,
i_t_select-low TO lr_vrgar-low,
i_t_select-high TO lr_vrgar-high.
APPEND lr_vrgar.
ENDLOOP.
*Fiscal Year
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_gjahr.
MOVE: i_t_select-sign TO lr_gjahr-sign,
i_t_select-option TO lr_gjahr-option,
i_t_select-low TO lr_gjahr-low,
i_t_select-high TO lr_gjahr-high.
APPEND lr_gjahr.
ENDLOOP.
*Period Block/Year
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_perbl.
MOVE: i_t_select-sign TO lr_perbl-sign,
i_t_select-option TO lr_perbl-option,
i_t_select-low TO lr_perbl-low,
i_t_select-high TO lr_perbl-high.
APPEND lr_perbl.
ENDLOOP.
*Value Field Name.
LOOP AT s_s_if-t_select INTO i_t_select WHERE fieldnm = c_fldnm.
MOVE:
i_t_select-sign TO gr_zfldnm-sign,
i_t_select-option TO gr_zfldnm-option,
i_t_select-low TO gr_zfldnm-low,
i_t_select-high TO gr_zfldnm-high.
APPEND gr_zfldnm.
ENDLOOP.
First data package -> OPEN CURSOR
IF ls_counter_datapakid = 0.
*Create 93 Field names in an internal table.
MOVE 'VV010' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV011' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV012' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV013' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV014' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV015' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV016' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV020' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV021' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV030' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV031' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV032' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV033' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV034' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV035' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV200' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV201' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV202' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV203' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV036' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV037' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV038' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV039' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV040' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV041' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV042' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV043' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV204' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV205' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV211' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV212' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV213' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV222' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV223' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV230' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV232' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV233' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV500' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV501' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV502' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV503' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV504' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV505' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV506' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV507' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV508' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV509' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV510' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV511' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV512' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV513' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV514' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV515' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV516' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV517' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV518' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV519' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV520' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV236' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV206' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV051' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV052' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV053' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV054' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV055' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV056' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV057' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV058' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV059' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV060' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV241' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV242' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV243' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV244' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV245' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV246' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV247' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV248' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV249' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV250' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV521' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV522' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV523' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV524' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV525' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV526' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV527' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV528' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV529' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV530' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV227' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV226' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
MOVE 'VV224' TO lw_fldlist-fldnam. APPEND lw_fldlist TO lt_fldlist.
OPEN CURSOR WITH HOLD ls_cursor FOR
SELECT
paobjnr " Profitability Segment Number (CO-PA)
paledger " Currency type for an operating concern
vrgar " Record Type
versi " Plan version (CO-PA)
gjahr " Fiscal Year
perbl " Fiscal year/period block
pasubnr
vv010001 " List Price
vv011001 " Formula Price
vv012001 " Customer Price
vv013001 " Manual Price
vv014001 " Retail Pump Price
vv015001 " Markup
vv016001 " Net Proceeds Other
vv020001 " Excise Duty Offset
vv021001 " Duties & Government
vv030001 " Sales Discounts
vv031001 " Sales Surcharges
vv032001 " Sales Rebates
vv033001 " Agents Comm Paid
vv034001 " RBA CR Royalties
vv035001 " Other Revenues
vv200001 " Transfer PriceSupply
vv201001 " Prim Tran Tariff Sup
vv202001 " S&Handling TariffDis
vv203001 " Sec Trans Tariff Dis
vv036001 " Proceeds from Servic
vv037001 " Exchanges
vv038001 " Throughput fees
vv039001 " Output Tax Offset
vv040001 " CR comm & Oth Oil Pr
vv041001 " Supplier fees
vv042001 " RBA Fairshare Adjust
vv043001 " Contr Comm Paid IG
vv204001 " Sec Tran Tariff Supp
vv205001 " Comp Stock Obligatio
vv211001 " Prim Tran Tar Transf
vv212001 " S&Handling Tar Trans
vv213001 " Sec Trans TariffTran
vv222001 " DIS:S&Handl Tar OvUn
vv223001 " DIS:Sec Tr TarifOvUn
vv230001 " Transfer Price LSC
vv232001 " S&Handling Tar LSC
vv233001 " Sec Trans Tariff LSC
vv500001 " 3rd Party Purchases
vv501001 " Transf from Oth Sect
vv502001 " Purchases IG
vv503001 " Inter-Seg Transf Pur
vv504001 " Import Freight
vv505001 " Stock Variations
vv506001 " Other Product Cost
vv507001 " Pipeline Operat Exp
vv508001 " Primary Transp Expen
vv509001 " Manufacturing Expens
vv510001 " Supply /Process Exp
vv511001 " MK Processing Plants
vv512001 " S&Handling Expenses
vv513001 " Sec Transp Expenses
vv514001 " Point of Sale Expens
vv515001 " Contr Comm Rec IG
vv516001 " Assoc Inc Dividend
vv517001 " Marketing & Sell Exp
vv518001 " Other Rev from Dist
vv519001 " Other Rev Transferrd
vv520001 " Stock Write-Off
vv236001 " Oth cost Tar LSC SMP
vv206001 " Prim Trp tariff Dist
vv051001 " CR Net Turnover
vv052001 " Dummy Price 2
vv053001 " Dummy Price 3
vv054001 " Dummy Price 4
vv055001 " Dummy Price 5
vv056001 " Dummy Price 6
vv057001 " Dummy Price 7
vv058001 " Dummy Price 8
vv059001 " Dummy Price 9
vv060001 " Dummy Price10
vv241001 " DummyTariff 1
vv242001 " DummyTariff 2
vv243001 " DummyTariff 3
vv244001 " DummyTariff 4
vv245001 " DummyTariff 5
vv246001 " DummyTariff 6
vv247001 " DummyTariff 7
vv248001 " DummyTariff 8
vv249001 " DummyTariff 9
vv250001 " DummyTariff10
vv521001 " SD&A Rebates
vv522001 " Dummy Cost 2
vv523001 " Dummy Cost 3
vv524001 " Dummy Cost 4
vv525001 " Dummy Cost 5
vv526001 " Dummy Cost 6
vv527001 " Dummy Cost 7
vv528001 " Dummy Cost 8
vv529001 " Dummy Cost 9
vv530001 " Dummy Cost 10
vv227001 " Sec Tr TarifOvUn LSC
vv226001 " S&Handl Tar OvUn LSC
vv224001 " Pr Tra TariffOvU DIS
FROM ce3op01
WHERE paledger = lc_02 AND
vrgar IN lr_vrgar AND
versi IN lr_versi AND
perbl IN lr_perbl AND
gjahr IN lr_gjahr.
ENDIF.
For all other cursors.
FETCH NEXT CURSOR ls_cursor
APPENDING TABLE lt_ce3op02
PACKAGE SIZE ls_s_if-maxsize.
IF sy-subrc <> 0.
EXIT.
ENDIF.
SORT lt_ce3op02 BY paobjnr pasubnr paledger vrgar versi gjahr
perbl.
DELETE ADJACENT DUPLICATES FROM lt_ce3op02 COMPARING paobjnr.
*Begin of MODE-002
DESCRIBE TABLE lt_ce3op02 LINES l_norecs.
l_s_loop_from = lc_1.
DO.
l_s_loop_to = l_s_loop_from + l_s_no_recs.
LOOP AT lt_ce3op02 INTO lw_ce3op02
FROM l_s_loop_from TO l_s_loop_to .
APPEND lw_ce3op02 TO lt_ce3op01.
ENDLOOP.
SORT lt_ce3op01 BY paobjnr.
*End of MOS-002
SELECT
aktbo " Current profitability segment (CO-PA)
paobjnr " Profitability Segment Number (CO-PA)
pasubnr " Profitability segment changes (CO-PA)
kndnr " Customer
artnr
bukrs " Company Code
prctr
kokrs
FROM ce4op01
INTO TABLE lt_ce4op01
FOR ALL ENTRIES IN lt_ce3op01
WHERE paobjnr = lt_ce3op01-paobjnr AND
pasubnr = lt_ce3op01-pasubnr AND
bukrs IN lr_bukrs.
*CE1op01
SELECT
paledger
vrgar
versi
perio
paobjnr
pasubnr
belnr
posnr
rbeln
rposn
FROM ce1op01
INTO TABLE lt_ce1op01
FOR ALL ENTRIES IN lt_ce3op01
WHERE paledger = lt_ce3op01-paledger AND
vrgar = lt_ce3op01-vrgar AND
versi = lt_ce3op01-versi AND
perio = lt_ce3op01-perbl AND
paobjnr = lt_ce3op01-paobjnr AND
pasubnr = lt_ce3op01-pasubnr.
**CE1op01
LOOP AT lt_ce3op01 INTO lw_ce3op01.
MOVE:
lw_ce3op01-paobjnr TO lw_flnmval-paobjnr,
lw_ce3op01-paledger TO lw_flnmval-paledger,
lw_ce3op01-vrgar TO lw_flnmval-vrgar,
lw_ce3op01-versi TO lw_flnmval-versi,
lw_ce3op01-gjahr TO lw_flnmval-gjahr,
lw_ce3op01-perbl TO lw_flnmval-perbl.
*appending all 93 fields as records
MOVE lw_ce3op01-vv010001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv011001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv012001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv013001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv014001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv015001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv016001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv020001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv021001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv030001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv031001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv032001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv033001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv034001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv035001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv200001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv201001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv202001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv203001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv036001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv037001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv038001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv039001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv040001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv041001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv042001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv043001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv204001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv205001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv211001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv212001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv213001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv222001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv223001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv230001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv232001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv233001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv500001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv501001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv502001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv503001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv504001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv505001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv506001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv507001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv508001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv509001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv510001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv511001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv512001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv513001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv514001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv515001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv516001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv517001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv518001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv519001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv520001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv236001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv206001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv051001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv052001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv053001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv054001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv055001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv056001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv057001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv058001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv059001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv060001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv241001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv242001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv243001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv244001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv245001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv246001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv247001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv248001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv249001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv250001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv521001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv522001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv523001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv524001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv525001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv526001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv527001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv528001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv529001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv530001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv227001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv226001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
MOVE lw_ce3op01-vv224001 TO lw_flnmval-zamunt.
APPEND lw_flnmval TO lt_flnmval.
*Segrigating all one record into 102 records is complete
ENDLOOP.
LOOP AT lt_flnmval ASSIGNING <fs_flnmval>.
IF l_index > 93.
l_index = 1.
ENDIF.
READ TABLE lt_fldlist INTO lw_fldlist INDEX l_index.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lw_fldlist-fldnam
IMPORTING
output = <fs_flnmval>-fldnam.
ENDIF.
l_index = l_index + 1.
ENDLOOP.
SORT lt_ce4op01 BY paobjnr.
SORT lt_ce1op01 BY paobjnr paledger vrgar versi.
SORT gr_zfldnm BY low.
DELETE lt_flnmval WHERE fldnam NOT IN gr_zfldnm.
LOOP AT lt_flnmval INTO lw_flnmval.
READ TABLE lt_ce4op01 INTO lw_ce4op01 WITH KEY
paobjnr = lw_flnmval-paobjnr BINARY SEARCH.
IF sy-subrc = 0.
MOVE : lw_flnmval-paledger TO lw_e_t_data-paledger,
lw_flnmval-vrgar TO lw_e_t_data-vrgar,
lw_flnmval-versi TO lw_e_t_data-versi ,
lw_flnmval-gjahr TO lw_e_t_data-gjahr,
lw_flnmval-perbl TO lw_e_t_data-perbl,
lw_ce4op01-bukrs TO lw_e_t_data-bukrs,
lw_ce4op01-kndnr TO lw_e_t_data-kndnr,
lw_ce4op01-artnr TO lw_e_t_data-artnr,
lw_ce4op01-prctr TO lw_e_t_data-prctr,
lw_ce4op01-kokrs TO lw_e_t_data-kokrs,
lw_flnmval-fldnam TO lw_e_t_data-zfldnm,
lw_flnmval-zamunt TO lw_e_t_data-zamount.
CE1op01
READ TABLE lt_ce1op01 INTO lw_ce1op01 WITH KEY
paobjnr = lw_flnmval-paobjnr
paledger = lw_flnmval-paledger
vrgar = lw_flnmval-vrgar
versi = lw_flnmval-versi BINARY SEARCH.
IF sy-subrc = 0.
MOVE: lw_ce1op01-rbeln TO lw_e_t_data-rbeln,
lw_ce1op01-rposn TO lw_e_t_data-rposn.
ENDIF.
CE1op01
APPEND lw_e_t_data TO gt_out_data.
ENDIF.
ENDLOOP.
*Begin of MOD-002
FREE lt_flnmval.
REFRESH :lt_ce3op01,lt_ce4op01,lt_ce1op01.
e_t_data[] = gt_out_data[].
DELETE e_t_data WHERE zfldnm NOT IN gr_zfldnm.
l_s_loop_from = l_s_loop_to + lc_1.
l_count = l_count + 20.
IF l_count GE l_norecs.
EXIT.
ENDIF.
ENDDO.
*End of MOD-002
ls_counter_datapakid = ls_counter_datapakid + 1.
ENDIF. "IF S_COUNTER_DATAPAKID = 0
ELSE.
IF i_maxsize IS INITIAL.
RAISE error_passed_to_mess_handler.
ENDIF.
IF g_start IS INITIAL.
g_start = 1.
ELSE.
g_start = g_end + 1.
ENDIF.
g_end = g_start + i_maxsize - 1.
Population of E_T_DATA based on Data records size
APPEND LINES OF gt_out_data FROM g_start TO g_end TO e_t_data.
DELETE e_t_data WHERE zfldnm NOT IN gr_zfldnm.
IF e_t_data[] IS INITIAL.
RAISE no_more_data.
ENDIF.
ls_counter_datapakid = ls_counter_datapakid + 1.
ENDIF.
ENDFUNCTION.
Thanks & regards,
Sreekanth
+91 9740091981Hello Sreekanth,
See this blog [Generic Extraction via Function Module|/people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module]
Also see this
[Line Item Level Data Extraction for Financial Accounting and Controlling|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a7f2f294-0501-0010-11bb-80e0d67c3e4a]
Thanks
Chandran -
Best way to select distinct values based on another column?
I have a table with three columns: id (NUMBER), data_dt (DATE), and data_value (NUMBER).
There is a primary key on id and data_dt.
I want to select the record with the latest data_dt for each unique id.
What is the best way to do this?
I have three different methods, but there may be something I am missing.
First:
SELECT *
FROM
SELECT id, data_dt, data_value,
FIRST_VALUE(data_dt)
OVER (PARTITION BY id ORDER BY data_dt DESC) AS last_data_dt
FROM the_table
WHERE data_dt = last_data_dt;(I use ORDER BY...DESC instead of just ORDER BY so I don't need the ROWS BETWEEN clause)
Second:
SELECT t1.*
FROM the_table t1
JOIN
SELECT id, MAX(data_dt) AS last_data_dt
FROM the_table
GROUP BY id
) t2 ON (t2.id = t1.id AND t2.data_dt = t1.data_dt);Third:
SELECT t1.*
FROM the_table t1
WHERE t1.data_dt =
SELECT MAX(t2.data_dt)
FROM the_table t2
WHERE t2.id = t1.id
);-- DonHi,
There are more possible scenario's, for example:
select t1.*
from the_table t1
where not exists ( select null
from the_table t2
and t2.data_dt > t1.data_dt
What is the best way to do this?Only you can tell:
Test all scenario's, check the execution plans, set timing on and pick the best/fastest one ;-)
If it's not clear, please post the execution plans here. -
Best way to create detail records based on data in the master record..
Hi,
I am using 11gr1p1 and ADF stack.
I have a master detail relation between 2 records. I have EO and entity associations. I want to create a number detail records based on the data on the master record.
For example
I have a Stay Record which has begin and end date I need to create the DailyStay Record for each day for the range of begin and end date of StayRecord.
Where should I do this? In EO implementation or in VO implementation.?
ThanksWhere should I do this? In EO implementation or in VO implementation.?If your child record should in no case be created without those default values, then EO.
Otherwise, to increase reusability of your EO, then in the VO over the view link (i.e. other VO's would still be able to use your EO without having the child VO created with these defaults).
This way your ViewObjects can also be used in a context where you don't want to copy from the masterFrank, If there's another UI flow that is so drastically different that it does not want things defaulted, then it probably needs a different VO altogether (on the same underlying EO though) -
Populate 1 table based on another table
I have a "VISITOR_TRACKER" application with the following 2 tables:
VISITORS (table)
VISITOR_ID (pk)
F_NAME
L_NAME
VISITOR_DETAILS (table)
V_DETAILS_ID (pk)
V_TIME_IN
V_DESTINATION
I want to do the following:
1. The visitor types in his/her last name in a search box.
2. Everyone with that last name shows up in either a report or a drop-down select list. The visitor selects his/her name.
3. A form "displays only" the name selected and has 2 text fields for the customer to enter their DESTINATION and TIME_IN and presses the submit button.
How do I set this up? The problem I'm encountering is that if I create a form w/report off of the VISITORS table, I'm unable to populate the DESTINATION and TIME-IN because the F_NAME and L_NAME from the VISITORS table is already popluted - it is trying to populate twice.
I tried basing the form w/report off of the VISITOR_DETAILS table but my report shows only the names that have any records in VISITOR_DETAILS. Also, the form shows the details of the VISITOR_DETAILS record that was selected.
My report query looks like this:
select "VISITOR_DETAILS"."V_DETAILS_ID" as "V_DETAILS_ID",
"VISITOR_DETAILS"."VISITOR_ID_LU" as "VISITOR_ID_LU",
"VISITORS"."F_NAME" || ' ' || "VISITORS"."L_NAME" as "NAME"
from "VISITOR_DETAILS" "VISITOR_DETAILS",
"VISITORS" "VISITORS"
where "VISITOR_ID_LU" = "VISITOR_ID"
I prefer to have a drop-down select list instead of a report if possible.
Please help! I have been working HOURS on this?if you only want a duplicat of the structure and don't worry about constraints, indexes, triggers etc you could use something like this
create table emp_dup as
select * from emp
where 1=0;Another more flexible way is to use the package DBMS_METADATA
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_metada.htm#ARPLS026 -
What is the best way to create a SSRS 2005 Line Chart Report for a 12 month period?
I'm looking for advice on how to create a SQL Server 2005 query and line chart report for SSRS 2005.
I need to display the peak number of patients assigned to a medical practice each month for a 12 month period based on the end-user selecting a
single month and year.
I've previously created a report that displays all patients assigned to the practice for any single month but I’m looking for advice on how to
how to produce a resultset that shows the peak number of patients each month for a 12 month period. I thought about creating a query that returns the peak count for each month (based on my previously created report which displays all patients assigned to the
practice for any single month) and then use a UNION statement to join all 12 months but I'm sure that isn't the most efficient way to do this. The other challenge with this approach (twelve resultsets combined via a UNION) is that the end-user needs to be
able to select any month and year for the parameter and the report needs to display the 12 month period based on the month selected (the month selected would be the last month of the 12 month period).
For the report I’ve previously created that displays all patients assigned to the practice for any single month, the WHERE statement filters the
resultset on two fields:
Start Date - The date the patient was assigned to the practice. This field is never null or blank.
End Date - The date the patient left the practice. This field can be null or blank as active patients assigned to the practice do not have an End Date. When the patient
leaves the practice, the date the patient left is populated in this field.
Using these two fields I can return all patients assigned to the practice during Nov 2012 by looking for patients that meet the following criteria:
start date prior to 11/30/2012 (using the last day of the month selected ensures patients added mid-month would be included)
AND
end date is null or blank (indicates the patient is active) OR the end date is between 11/1/2012 -11/30/2012 (returns patients that leave during the month
selected)
Regarding the query I need to create for the report that displays the peak count each month for 12 months, I'm looking for advice on
how to count patients for each month the patient is assigned to the practice if the patient has been assigned for several months (which applies to most patients). Examples are:
John Doe has a start date of 6/01/2012 and an End Date of 10/07/2012
Sally Doe has a start date of 8/4/2012 and no End Date (the patient is still active)
Jimmy Doe has a start of 7/3/2012 and an End Date of 9/2/2012
Given these examples how would I include John Doe in the peak monthly count each month for May - October, Sally Doe in the peak monthly count for
August - December and Jimmy Doe in the peak monthly count for July – Sept if the end-user running the report selected December 2012 as the parameter?
Given the example above and the fact I'm creating a line chart I think the best way to create this report would be a resultset that looks like
this:
Patient Name
Months Assigned
John Doe
June 2012
John Doe
July012
John Doe
Aug 2012
John Doe
Sept 2012
John Doe
Oct 2012
Sally Doe
Aug 2012
Sally Doe
Sept 2012
Sally Doe
Oct 2012
Sally Doe
Nov 2012
Sally Doe
Dec 2012
Jimmy Doe
July 2012
Jimmy Doe
Aug 2012
Jimmy Doe
Sept 2012
From the resultset above I could create another resultset that would count\group on month and year to return the peak count for each month:
June 2012 - 1
July 2012 – 2
Aug 2012 - 3
Sept 2012 - 3
Oct 2012 - 2
Nov 2012 - 1
Dec 2012 - 1
The resultset that displays the peak count for each month would be used to create the line chart (month would be the X axis and the count would
be the y axis).
Does this sound like the best approach?
If so, any advice on how to create the resultset that lists each patient and each month they were assigned to the practice would be greatly appreciated.
I do not have permissions to create SPs or Functions within the database but I can create temp tables.
I know how to create the peak monthly count query (derived from the query that lists each patient and month assigned) as well as the line chart.
Any advice or help is greatly appreciated.Thanks for the replies. I reviewed them shortly after they were submitted but I'm also working on other projects at the same time (hence the delayed reply).
Building a time table and doing a cross join to my original resultset gave me the desired resultset of the months assigned between dates. What I can't figure out now is how to filter months I don't want.
Doing a cross join between my original resultset that had two dates:
08/27/2010
10/24/2011
and a calendar table that has 24 rows (each month for a two year period)
my new resultset looks like this:
I need to filter the rows in yellow as the months assigned for stage 3 that started on 8/27/2010 should stop when the patient was assigned to stage 4 on 10/24/2011.
You'll notice that Jan - Sept 2011 isn't listed for Stage 4 assigned on 10/24/2011 as I included a filter in the WHERE clause that states
the Months Assigned value must be greater than or equal to the date assigned value.
Any advice would be appreciated. -
What is the best way to create a database schema from XML
What is the best way to create a database schema from XML?
i have a complex XML file that I want to create a database from and consistently import new XML files of the same schema type. Currently I have started off by mapping the XSD into Excel and using Mysql for Excel to push into MySQL.
There must be a more .net microsoft solution for this but I cannot locate the topic and tools by searching. What are the best tools and way to manage this?
Taking my C# furtherHi Saythj,
When mentioning "a database schema from XML", do you mean the
XML Schema Collections? If that is what you mean, when trying to import XML files of the same schema type, you may take the below approach.
Create an XML Schema Collection basing on your complex XML, you can find
many generating tools online to do that.
Create a Table with the above created schema typed XML column as below.
CREATE TABLE youTable( Col1 int, Col2 xml (yourXMLSchemaCollection))
Load your XML files and try to insert the xml content into the table above from C# or some other approaches. The XMLs that can't pass the validation fail inserting into that table.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
What is the best way to create CRUD datagrids
What is the best way to create CRUD datagrids that tell CF
components to update sql tables. I find that I'm having to vreate
all these columns with custom properites and its a bit of a chore:
<mx:DataGridColumn id = "NatWest" dataField="NatWest"
headerText="NatWest" editable="false"
wordWrap="true"
textAlign="right"
headerStyleName="centered"
labelFunction="price_labelFuncNatWest"
sortCompareFunction="price_sortCompareFunc">
I don't really want to use any wizards as I want control over
my code.Hi Saythj,
When mentioning "a database schema from XML", do you mean the
XML Schema Collections? If that is what you mean, when trying to import XML files of the same schema type, you may take the below approach.
Create an XML Schema Collection basing on your complex XML, you can find
many generating tools online to do that.
Create a Table with the above created schema typed XML column as below.
CREATE TABLE youTable( Col1 int, Col2 xml (yourXMLSchemaCollection))
Load your XML files and try to insert the xml content into the table above from C# or some other approaches. The XMLs that can't pass the validation fail inserting into that table.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
Need help knowing best way to create record
What is the best way to create a new record... I have a form pulling info from about 20 tables. When the user wants to create a new record, I want a new form to open and allow them to select the values based on the foreign key fields so it makes more sense than just random numbers.
The problem I'm having is knowing when and how to insert. Should the "new record" form be it's own database block that inserts from within it. (but then when they go back to the original form they must requery to see the new value.) Or what about copying each field back to the original form. I'm new to forms and would appreciate any insight and tips.would a wire like this help me?
I doubt it. You want FireWire.
Take look at the Canopus ADVC300. It comes with a nice Macintosh application that works flawlessly with iMovie 06.
http://www.canopus.com/products/ADVC300/index.php
Yes, it does cost more but it works. -
Best way to create menus [was: Queston]
What technique or is a template used to create the menu for this Adobe page? I have been studying web development (reading and tutorials) and the sections are always short on creating menus. Mostly, covers creating buttons with behaviors in Fireworks and inserting them into Navigation Bars and Tables? What are the best ways to create menus?
[Subject line edited by moderator]Howdy,
The best way is definately not the Fireworks way. Never has been.
Take RJweb's advise and check out the PVII Menu Magic. I use that all the time and its very easy to customize with its well laid out CSS files. I havn't found anything easier to use and customize yet.
Brad Lawryk
Community Expert: Dreamweaver
Usergroup Manager: Northern British Columbia Adobe Usersgroup -
Best way to create a conact list from the user profile properties
We have a customer looking for a phone book utility, starting with a table showing main user information and with some search options. We would like o base it on the user profile properties and not to create an indipendent studion record browser porlet.
What is best way to create a conact list from the user profile properties ?I did something like this using search. It can get messy, so you need to take care with it.
* Identify the properties you want to make accessible to search (ex: name, etc.)
- add them to the user property map
- flag them as searchable
* I broke down and used the native server API. I'd still suggest this approach.
* Write some simple code to do vcard export if you like
(my code is all in vb.net)
I really believe this is the "right" approach, but honestly, this was a bit painful and has been
messy for us given some other business issues. (to my chagrin we have users with 2-letter last
names...)
I have code you're welcome to poke at, but it's more or less slapped together and has various
different search methods commented out so you can see how I tinkered w/ the remote vs. server
API.
If you'd like it mail me at [email protected] and I'll send you a zipped copy w/ a
readme. I hope it may be useful to you as both a starting reference. -
Best way to create a Contact Us form
What is the best way to create a contact us form?
I created mine using a table and the form sleection of DW CS6.
Thanks!
JanelleCreating the form itself is really only half the job.
You can have a marvelous form created using html and DW's built in form items. Those items can be in a table, or not, that part is up to you. The next step is making the form "do something".
The simplest way to make a form work, is a mailto: link in the form action attribute, but it's the absolute worst way to go. Mailto: links require the viewer to have an email client installed and set up on the computer they're using to submit your form. If they don't (as in the case of Gmail, htomail, yahoo, etc mail users) when they click Submit, absolutely nothing will happen.
Another drawback of using a mailto: link for your form submission is that email address is now open to every spam email harvester on the internet. If you like certain "blue pill emails" then there wouldn't be an issue, but if you are like the majority of society, you won't be sending funds to any Nigerian doctors either and won't want to be spammed constantly.
Personally, I use the Formmail script, available for free at http://www.tectite.com for pretty much all of my html forms. As long as your server has PHP installed (most do) the Formmail script will work very well for you. They have a ton of "How To" info on their site and the script itself is very robust with loads of features you can use, or not, at your discretion. They also have a very well documented troubleshooting section and a searchable forum that take care of the most common issues you run into.
Your next step is "find out what server scripting language you have available on your server". From there, you'll need to find/write a compatible script, then attach your form to it. -
Best way to create frame with stroke around a paragraph?
What is the best way to create a frame with a stroke around text? I
always thought it was with an inline frame, but now I see that trying to
put the cursor in the text is very difficult because the frame blocks
the cursor. Is there a better way?Thanks guys.
What I was doing was putting the anchored frame in an empty paragraph
above the paragraph that needed the box. The problem was when I tried to
put the cursor in the text the anchored frame blocked it. Why is an
anchored frame on top of text?
The easy solution would be to cut/paste the text into the anchored frame
(which would be similar to Ole's single cell table idea). I didn't want
to go this route for two reasons:
1) I don't want to cut and paste every paragraph.
2) I didn't want the story to be broken up. I wanted it to be one long
flow of text. It makes tings easier just in case the paragraphs have to
break across two pages.
Jongware's underline/strikethrough idea is another good one, but I don't
like the idea of putting in all those extra characters.
What I ended up doing was using paragraph rules. I set the rule above to
1pt larger on all sides than the rule below so it looked like a box with
a stroke. Of course, the problem with paragraph rules is getting it the
right size. I wrote a script that calculates the size of the text and
sets the rule size the correct amount.
Of course this still has its problems when the boxes need to break pages... -
Please introduce the best way to create education in share point
Hi
I want to use chm in share point. but i suppose that there are better ways for training because i think chm is suit for software that are windows-based not web based.
please introduce the best way to create education in share point
thanksHi
these are some directions which will help to create a project for your needs
Record and share grades with students and parents electronically.
Create online communities for teachers, administrators, and students to collaborate.
Facilitate sharing of best practices among teachers and administrators.
Enable students, parents, faculty, and administrators to access your institution's resources anytime from any connected device.
Post lesson plans, research content, coursework, and more to online document libraries.
Provide Web-based class registration, lunch ordering, and other services.
Create dashboards that show up-to-date student performance data to inform instruction and decisions.
Share information with your district personnel, school board, parents, and community members.
Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.
Maybe you are looking for
-
my imac is less than 5 months. old tommorow it goes to murcia for ¿repair?.a 25.1 1mac desktop is a formidable piece of workmanship but thatdoes not stop anything going wrong,as ive found out.in the last month it has begun to heat rapidly thus i thin
-
Exporting a system with NW2004s - r3load option do nothing !
Dear colleagues , exporting an ABAP database based on NW2004s on Linux/oracle 10 on linux suse on IA64 do noting .This export is a part from unicode conversion for Solution Manager 4.0 - oracle 10.2 , linux suse 9 on IA64 , export phase after unicode
-
Can a dynamic select stmt in a ref cursor be done?
Hello all! I have a form in which a user can select a number of checkboxes that coorespond to fields in a table. After checking the desired boxes, the user can then click on a button and a variable (v_query) in a "when button pressed" trigger is popu
-
I have got problem to create Session Bean
Hi I am new in j2ee. I have installed the eclipse 3.1, j2sdk1.4.2_07 and tomcat 5.0. I have created a ejb with a session bean and it gives me a error the program doesn't find the class javax.ejb.SessionBean. My question is Can this error happen becau
-
What does Locked Sim mean? It's on my front upper left corner on My other phone? And how did it get locked and how to unlock ?