Move data between tables with INSERT-LOOP?
Greetings
I need to move all the contact information (contained in 5
fields- call it the address table) into the table (call it the main
table) that contains all the other associated information. Tables
are related via the "vendor_ID" key field.
There are about 7000 records.
I tried the attached code- with no luck- am I in the
ballpark?
Thanks!
newportri
Sorry- yes the tables are in the same DB because I imported
them together.
I am trying to clean this DB up for eventual porting to SQL
Server (it is in Access now) - I saw no good reason why the
designer used 2 separate tables- one with most info on each vendor,
but split the addresses off in another table?
I guess there are lumpers and splitters- but I can't see the
point of inserting/updating/deleting form 2 tables vs 1?
ERROR: The field 'Vendor1.vendor_ID' cannot contain a Null
value because the Required property for this field is set to True.
Enter a value in this field.
Thanks for your quick response.
Similar Messages
-
I use SQL*Loader to load data into a interface table where I do some data cleaning.
Is there a easy way of moving the data from the interface table to a target table inside the same database, keeping in mind that the target table already contains data.
I normally export the data from the interface table, create a data and control file and use SQL*Loader again, but this seems like such a long way, surely there should be a easier way??
Thank you in advanceIt's not a problem that the target table contains more columns, you can either do ...
insert into my_target (col1, col2, col3, col4,col5)
select col_a, col_b, 'my_default_value',null, sysdate
from my_source;
... or ...
insert into my_target (col1, col2)
select co;l_a, col_b
from my_source;
The second statement will automatically put NULL into columns not listed after my_target, the first statement allows you to specify NULL explicitly or specify some static or dynamic default value.
I guess you have to find out why it's taking so long to insert the values. My guess would be that you have indexes on the table that are slowing things up. You may find it beneficial to drop the indexes, load the new data, rebuild the indexes.
You could also add the APPEND hint to the insert ...
insert /*+ append */ into my_target ...
... which might speed things up a little. Also check that your pctfree value for the table is set very low (0) and pctused is very high (99) if you are not going to be updating these rows in future -- this will pack more rows into each block.
Another option is to partition your target table, and use the EXCHANGE PARTITION mechanism to get data into it. -
hallow
i have table a_itab with begdate and endate and i wont to move it to table
with period and price for period <b>on every month</b>
how is the <b>best</b> way to do that?
<b><REMOVED BY MODERATOR></b>
i give example
a_itab
reserc--endate---begdate--knumh--
price
0000008254 20070330 20070101 0000014850 3000.00
0000010599 20080731 20080401 0000014851 15000.00
0000123456 20070331 20070101 0000014834 20000.00
0000123456 20070631 20070601 0000014835 80.00
i wont
b_itab
period----price--
reserc
012007--3000.00--
0000008254
022007--3000.00--
0000008254
032007 3000.00 0000008254
042008 15000.00 0000010599
052008 15000.00 0000010599
062008 15000.00 0000010599
072008 15000.00 0000010599
012007 20000.00 0000123456
022007 20000.00 0000123456
032007 20000.00 0000123456
042007 80.00 0000123456
052007 80.00 0000123456
062007 80.00 0000123456
Regards
Message was edited by:
Alvaro Tejada GalindoHi,
Please try this.
DATA: DURATION TYPE I,
DATE TYPE SY-DATUM.
LOOP AT A_ITAB.
CALL FUNCTION 'HR_GBSXP_GET_MONTHS'
EXPORTING
FIRST_DATE = A_ITAB-BEGDATE
SECOND_DATE = A_ITAB-ENDDATE
MODIFY_INTERVAL = ' '
IMPORTING
DURATION = DURATION
EXCEPTIONS
INVALID_SEQ_DATES = 1
OTHERS = 2.
DURATION = DURATION + 1.
DO DURATION TIMES.
IF SY-INDEX = 1.
DATE = A_ITAB-BEGDATE.
ELSE.
IF DATE+4(2) = '12'.
DATE(4) = DATE(4) + 1.
DATE+4(2) = 1.
ELSE.
DATE+4(2) = DATE+4(2) + 1.
ENDIF.
ENDIF.
B_ITAB-PERIOD = DATE(6).
B_ITAB-PRICE = A_ITAB-PRICE.
B_ITAB-RESERC = A_ITAB-RESERC.
APPEND B_ITAB.
ENDDO.
ENDLOOP.
Regards,
Ferry Lianto -
How can I load data into table with SQL*LOADER
how can I load data into table with SQL*LOADER
when column data length more than 255 bytes?
when column exceed 255 ,data can not be insert into table by SQL*LOADER
CREATE TABLE A (
A VARCHAR2 ( 10 ) ,
B VARCHAR2 ( 10 ) ,
C VARCHAR2 ( 10 ) ,
E VARCHAR2 ( 2000 ) );
control file:
load data
append into table A
fields terminated by X'09'
(A , B , C , E )
SQL*LOADER command:
sqlldr test/test control=A_ctl.txt data=A.xls log=b.log
datafile:
column E is more than 255bytes
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)Check this out.
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1006961 -
Create data base table with EXEC SQL
Hello,
I nead to create o data base table with EXEC SQL in an Abap program.
My code is :
TRY.
EXEC SQL.
CREATE table zt_hello ( mandt char(4) NOT NULL,
kunnr char(10) NOT NULL,
PRIMARY KEY (mandt, kunnr) )
ENDEXEC.
CATCH cx_sy_native_sql_error INTO exc_ref.
error_text = exc_ref->get_text( ).
ENDTRY.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
But it still not working.
Can you help me please.
Thanks.
Edited by: widad soubhi on Jul 14, 2010 5:26 PMPlease refer this code
REPORT z_struct_create .
DATA: my_row(500) TYPE c,
my_file_1 LIKE my_row OCCURS 0 WITH HEADER LINE.
DATA: dd02v TYPE dd02v.
DATA: my_file_tab1 LIKE dd03p OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text
NO INTERVALS.
PARAMETERS:
name TYPE ddobjname,
testo TYPE text40,
file_1 LIKE rlgrap-filename.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK blk.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_1.
PERFORM file_selection USING file_1.
INITIALIZATION.
text = text-001.
START-OF-SELECTION.
IF file_1 IS INITIAL.
MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 001.
EXIT.
ENDIF.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = file_1
filetype = 'ASC'
TABLES
data_tab = my_file_1.
IF sy-subrc 0.
MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 002.
EXIT.
ENDIF.
LOOP AT my_file_1.
IF sy-tabix > 1.
CLEAR my_file_tab1.
SPLIT my_file_1 AT ';' INTO
my_file_tab1-fieldname
my_file_tab1-datatype
my_file_tab1-leng
my_file_tab1-decimals
my_file_tab1-ddtext
my_file_tab1-inttype = 'C'.
my_file_tab1-INTLEN = my_file_tab1-leng.
my_file_tab1-tabname = name.
my_file_tab1-position = sy-tabix - 1.
my_file_tab1-ddlanguage = sy-langu.
my_file_tab1-OUTPUTLEN = my_file_tab1-leng.
APPEND my_file_tab1.
ENDIF.
ENDLOOP.
dd02v-tabname = name.
dd02v-ddlanguage = sy-langu.
dd02v-tabclass = 'INTTAB'.
dd02v-DDTEXT = testo.
dd02v-MASTERLANG = sy-langu.
IF NOT my_file_tab1[] IS INITIAL.
CALL FUNCTION 'DDIF_TABL_PUT'
EXPORTING
name = name
dd02v_wa = dd02v
TABLES
dd03p_tab = my_file_tab1
EXCEPTIONS
tabl_not_found = 1
name_inconsistent = 2
tabl_inconsistent = 3
put_failure = 4
put_refused = 5
OTHERS = 6
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 003.
EXIT.
ENDIF.
*& Form file_selection
-->P_FILE_1 text
FORM file_selection USING p_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'c:\'
mask = ',.,..'
mode = '0'
title = 'Selezione file'
IMPORTING
filename = p_file
RC = RCODE
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
ENDFORM. " file_selection
File Template:
Fieldname;Data Type;Lentgh;Dec.;Descr.
FIELD1;CHAR;000020;000000;my field 1
FIELD2;CHAR;000008;000000;my field 2
FIELD3;CHAR;000007;000000;my field 3
FIELD4;CHAR;000006;000000;my field 4 -
Problems with retrieving data from tables with 240 and more records
Hi,
I've been connecting to Oracle 11g Server (not sure exact version) using Oracle 10.1.0 Client and O10 Oracle 10g driver. Everything was ok.
I installed Oracle 11.2.0 Client and I started to have problems with retrieving data from tables.
First I used the same connection string, driver and so on (O10 Oracle 10g) then I tried ORA Oracle but with no luck. The result is like this:
I'm able to connect to database. I'm able to retrieve data but from small tables (e.g. with 110 records it works perfectly using both O10 and ORA drivers). When I try to retrieve data from tables with like 240 and more records retrieval simply hangs (nothing happens at all - no error, no timeout). Application seems to hang forever.
I'm using Powerbuilder to connect to Database (either PB10.5 using O10 driver or PB12 using ORA driver). I used DBTrace, so I see that query hangs on the first FETCH.
So for the retrievals that hang I have something like:
(3260008): BIND SELECT OUTPUT BUFFER (DataWindow):(DBI_SELBIND) (0.186 MS / 18978.709 MS)
(3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=0
(3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=1
(3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=0
(3260008): EXECUTE:(DBI_DW_EXECUTE) (192.982 MS / 19171.691 MS)
(3260008): FETCH NEXT:(DBI_FETCHNEXT)
and this is the last line,
while for retrievals that end, I have FETCH producing time, data in buffer and moving to the next Fetch until all data is retrieved
On the side note, I have no problems with retrieving data either by SQL Developer or DbVisualizer.
Problems started when I installed 11.2.0 Client. Even if I want to use 10.0.1 Client, the same problem occurs. So I guess something from 11.2.0 overrides 10.0.1 settings.
I will appreciate any comments/hints/help.
Thank you very much.pgoel wrote:
I've been connecting to Oracle 11g Server (not sure exact version) using Oracle 10.1.0 Client and O10 Oracle 10g driver. Everything was ok.Earlier (before installing new stuff) did you ever try retrieving data from big tables (like 240 and more records), if yes, was it working?Yes, with Oracle 10g client (before installing 11g) I was able to retrieve any data, either it was 10k+ records or 100 records. Installing 11g client changed something that even using old 10g client (which I still have installed) fails to work. The same problem occur no matter I'm using 10g or 11g client now. Powerbuilder hangs on retrieving tables with more than like 240 records.
Thanks. -
How to move data between two similar tables?
Hi All,
I have two tables with almost the same columns. Table A has 50 columns, Table B has 51 columns, which are defined exactly the same except one more column as LOAD_TIME.
Is there any easy way for me to move the data from Table A to B? the Extra column LOAD_TIME will be set as current system time. All I want is to avoid list all 50 column names. The following SQL has error ORA-00923 error.
INSERT INTO TB_B
SELECT *, sysdate from TB_A;
Thanks,939569 wrote:
Hi All,
I have two tables with almost the same columns. Table A has 50 columns, Table B has 51 columns, which are defined exactly the same except one more column as LOAD_TIME.
Is there any easy way for me to move the data from Table A to B? the Extra column LOAD_TIME will be set as current system time. All I want is to avoid list all 50 column names. The following SQL has error ORA-00923 error.
INSERT INTO TB_B
SELECT *, sysdate from TB_A;
Thanks,You could create a view based on TB_A.
However i don't understand why you feel the need to avoid specifying the columns. That's a better way to code.
Granted, i also don't understand why you'd have 2 copies of the same data, the only differentiation being when you copied the data from the source to the redundant table.
Cheers, -
Cann't move data between two internal table in Unicode program
Hello expert,
I import a program from old sap system to new system, but syntax error occurred --- ' L_T_S776[] = T_DATA_RECORDS[]. ',
it is said ' internal table L_T_S776 and T_DATA_RECORDS are not mutually convertible, in unicode program, two internal tables must have the same structure layout'.
The coding is:
DATA: L_T_S776 LIKE S776 OCCURS 0 WITH HEADER LINE.
DATA: L_T_S777 LIKE S777 OCCURS 0 WITH HEADER LINE.
FIELD-SYMBOLS: <F_S776> TYPE S776.
FIELD-SYMBOLS: <F_S777> TYPE S777.
IF NOT ZCL_USEREXIT=>IS_ACTIVE( PROJN = 11 EXITN = 34 ) IS INITIAL.
CASE I_RMCP2-SCTYP.
WHEN 'Z776'.
L_T_S776[] = T_DATA_RECORDS[].
LOOP AT L_T_S776 ASSIGNING <F_S776>.
<F_S776>-ZZCUSER = SY-UNAME.
<F_S776>-ZZCDATE = SY-DATUM.
<F_S776>-ZZCTIME = SY-TIMLO.
ENDLOOP.
T_DATA_RECORDS[] = L_T_S776[].
WHEN OTHERS.
ENDCASE.
internal table T_DATA_RECORDS is defined to like INDX.
this program is in function module EXIT_SAPMMCP6_011, it is a user_exit.
I also confuse the meaning of this part of coding, could anybody help me?
reward if got useful reply, thank you.
H.BHi,
The structure are different thats why you getting this error. But there must be some fields common to which you want to move data. So you change in that way.
And there will be no impact whatsoever because of such change.
Regards,
Atish -
How to update the data base table with data
i have two ztables, one is zfm_kfz and other one is zfm_kmvrg
zfm_kfz is maintained by using table maintenance generator as well as alv grid control for list display.
zfm_kfz the field r like this KFZR, GERAET, KOSTENTRAEGER, BEZEICHNUNG, TUVDATUMMMYYYY, ASUDATUMMMYYYY, KMSTAND, HISTO AND REIFEN.
PROBLEM: all the data in grid control r updated except KMSTAND
fields in zfm_kmvrg are kostentraeger, kfznr and kmstand i m creating table control for this screen here what ever enter the last km stand is updated in the list.for one kfznr many kostentraegers and kmstand, the last km stand is updated here , go through this code plz hepl me
CONTROLS tabctrl TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF tabctrl-cols,
lines TYPE i.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF zfm_kmvrg,
fs_itab LIKE LINE OF itab,
fl_change TYPE c,
fl_error TYPE c.
*TABLES fs_itab.
LOOP AT tabctrl-cols INTO cols.
cols-screen-input = '0'.
MODIFY tabctrl-cols FROM cols INDEX sy-tabix.
ENDLOOP.
*SELECT * FROM spfli INTO TABLE itab.
CALL SCREEN 100.
MODULE status_0100 OUTPUT
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_101'.
DESCRIBE TABLE itab LINES lines.
tabctrl-lines = lines.
ENDMODULE. "status_0100 OUTPUT
MODULE cancel INPUT
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE. "cancel INPUT
MODULE read_table_control INPUT
MODULE read_table_control INPUT.
MODIFY itab FROM fs_itab INDEX tabctrl-current_line.
ENDMODULE. "read_table_control INPUT
MODULE user_command_0100 INPUT
MODULE user_command_0100 INPUT.
DATA:
lw_index TYPE i.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'ADD'.
LOOP AT tabctrl-cols INTO cols.
cols-screen-input = '1'.
MODIFY tabctrl-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CLEAR fs_itab.
APPEND fs_itab TO itab.
WHEN 'SAVE'.
IF NOT itab[] IS INITIAL.
LOOP AT itab[] into FS_ITAB.
lw_index = sy-tabix.
IF NOT fs_itab IS INITIAL.
MODIFY ZFM_KMVRG FROM fs_itab.
IF sy-subrc EQ 0.
UPDATE ZFM_KFZ set kmstand = fs_itab-kmstand
WHERE kfznr = fs_itab-kfznr.
ELSE.
fl_error = 'X'.
WRITE:/ 'The record number', lw_index,
'has not been updated'.
ENDIF.
ENDIF.
ENDLOOP.
ELSE.
MESSAGE s000(0) WITH 'No data is present to update'.
ENDIF.
ENDCASE.
IF fl_error = 'X'.
LEAVE TO LIST-PROCESSING.
ELSE.
MESSAGE s000(0) WITH
'All the records have been updated successfully'.
ENDIF.
ENDMODULE. "user_command_0100 INPUT
IN SE51
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT ITAB INTO fs_itab WITH CONTROL tabctrl.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
LOOP AT ITAB.
module read_table_control.
ENDLOOP.
module user_command_0100.
i m trying many times i m not getting proper output, plz help me on thisHi,
I am hereby givng the similar sample code.Check this with your requirement.
In the flow logic of the screen 9000, write the following code.
PROCESS BEFORE OUTPUT.
MODULE set_status.
MODULE get_t_ctrl_lines.
LOOP AT i_makt WITH CONTROL t_ctrl CURSOR t_ctrl-current_line.
* Dynamic screen modifications
MODULE set_screen_fields.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT i_makt.
FIELD i_makt-pick MODULE check.
FIELD i_makt-zmatnr MODULE zmatnr .
ENDLOOP.
MODULE user_command_9000.
In the program, write the following code.
PROGRAM SAPMZTC MESSAGE-ID zz.
* Tables Declaration
TABLES: zzz_makt.
* Internal table Declaration
DATA : i_makt TYPE STANDARD TABLE OF zzz_makt WITH HEADER LINE.
* Table control Declaration
CONTROLS: t_ctrl TYPE TABLEVIEW USING SCREEN '9000'.
* Variable Declaration
DATA : flg, "Flag to set the change mode
ln TYPE i. "No. of records
*& Module get_T_CTRL_lines OUTPUT
* Populating data
MODULE get_t_ctrl_lines OUTPUT.
SELECT zmatnr zmaktx
INTO CORRESPONDING FIELDS OF TABLE i_makt
FROM zzz_makt.
DESCRIBE TABLE i_makt LINES ln.
* To make the vertical scroll bar to come on runtime
t_ctrl-lines = ln + 100.
ENDMODULE. " get_T_CTRL_lines OUTPUT
*& Module USER_COMMAND_9000 INPUT
* Triggering event according to the user command
MODULE user_command_9000 INPUT.
DATA :lv_fcode LIKE sy-ucomm, "Function Code
lv_answer(1) type c. "Storing the answer
lv_fcode = sy-ucomm.
CASE lv_fcode.
WHEN 'CHANGE'.
* Setting the flag to make the table control in editable mode[excluding
* primary key].
flg = 'Y'.
WHEN 'DELETE'.
* Setting the flag to make the table control in editable mode after
* deleting the selected line
flg = 'Y'.
* Confirmation of delete
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Confirm'
text_question = 'Are you sure to delete from database?'
TEXT_BUTTON_1 = 'Yes'(001)
TEXT_BUTTON_2 = 'No'(002)
IMPORTING
ANSWER = lv_answer.
if lv_answer eq '1'.
* Updating the database table from the internal table
UPDATE zzz_makt FROM TABLE i_makt.
* Deleting the selected row from the internal table
DELETE i_makt WHERE pick = 'X'.
* Deleting the selected row from the database table
DELETE FROM zzz_makt WHERE pick = 'X'.
MESSAGE s005 WITH 'Deleted Successfully'.
ENDIF.
WHEN 'SAVE'.
* Inserting new record or updating existing record in database table
* from the internal table
MODIFY zzz_makt FROM TABLE i_makt.
MESSAGE s005 WITH 'Saved Successfully'.
WHEN 'BACK'.
SET SCREEN '0'.
WHEN 'EXIT' OR 'CANCEL'.
* Leaving the program
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Module set_screen_fields OUTPUT
* Setting the screen fields
MODULE set_screen_fields OUTPUT.
LOOP AT SCREEN.
IF flg IS INITIAL.
screen-input = 0.
ELSEIF ( flg EQ 'Y' ).
IF ( ( screen-name = 'I_MAKT-ZMAKTX'
OR screen-name = 'I_MAKT-CHECK1' )
AND t_ctrl-current_line LE ln ) .
* Making the screen fields as editable
screen-input = 1.
ELSEIF ( ( screen-name = 'I_MAKT-ZMATNR' )
AND t_ctrl-current_line LE ln ).
* Making the screen field as uneditable
screen-input = 0.
ENDIF.
ENDIF.
* Modifying the screen after making changes
MODIFY SCREEN.
ENDLOOP.
ENDMODULE. " set_screen_fields OUTPUT
*& Module zmatnr INPUT
* Appending records to the internal table
MODULE zmatnr INPUT.
MODIFY i_makt INDEX t_ctrl-current_line.
IF t_ctrl-current_line GT ln.
READ TABLE i_makt WITH KEY zmatnr = i_makt-zmatnr.
IF sy-subrc NE 0.
* Inserting record if it does not exist in database
APPEND i_makt.
ELSE.
MESSAGE i005 WITH 'Material Number' i_makt-zmatnr 'already exists'.
ENDIF.
ENDIF.
ENDMODULE. " zmatnr INPUT
*& Module set_status OUTPUT
* Setting the GUI status
MODULE set_status OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'ZTITLE'.
ENDMODULE. " set_status OUTPUT
*& Module CHECK INPUT
* Modify the internal table using the current line in table control
MODULE check INPUT.
MODIFY i_makt INDEX t_ctrl-current_line.
ENDMODULE. " CHECK INPUT -
Sql*loader - load data in table with multiple condition
Hi,
I have oracle 9i on Sun sloaris and i need to load data in one of oracle table using sql*loader with conditional column data.
My table is like:
Load_table
col1 varchar2(10),
col2 varchar2(10),
col3 varchar2(10),
Now i have to load data like:
If col2 = US1 then col3 = 'AA'
If col2 = US2 then col3 = 'BB'
If col2 = US3 then col3 = 'CC'
How can i load this data in table using sql*loader?
Thanks,
PoraHi
it is a half-solution.
You have to:
1. open file
2. take a line
3. split the line into values (using substring to)
4. check condition (01 or 02)
5. do a proper insertion
Good Luck,
Przemek
DECLARE
v_dir VARCHAR2(50) := 'd:/tmp/'; --directory where file is placed
v_file VARCHAR2(50) := 'test.txt'; -- file name
v_fhandle UTL_FILE.FILE_TYPE; ---file handler
v_fline VARCHAR2(906); --file line
v_check VARCHAR2(50);
BEGIN
v_fhandle := UTL_FILE.FOPEN(v_dir, v_file, 'R'); --open file for read only
LOOP -- in the loop
UTL_FILE.GET_LINE( v_fhandle , v_fline); -- get line by line from file
if (substr(v_fline,17,2) = '01') then --check the value
INSERT INTO ... -- Time_in
else
INSERT INTO ... -- Time_out
end if;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN UTL_FILE.FCLOSE( v_fhandle );
END; -
Moving data between tables (how to find out if the 2nd table is empty)
Hi,
I have 2 tables, and I'm copying records from one table to another.
I've followed the Wiki: [https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/movingdatabetween+tables]
So far, everything works ok.
Here is my question: how do I get the number of records passed?
I mean, how do I know the number of rows in the 2nd table? (Remember that this number is variable, because it depends on how many rows I've inserted and deleted on the 2nd table).
I've tried to achieve that using a data store with a numeric field, but I couldn't find the way to increment/decrement the numeric field on data store, and insert/delete the row on table at the same time .
All I want is to find out if the 2nd table is empty or not.
Any ideas to solve this?
Thanks in advance!
Help will be point-rewarded.
MarceloHi Ahmed
thanks for your reply, it was very helpful!! (I've assigned points to you)
However the user can add twice or more times the same row... so the counter doesn't reflect the real number of rows in the 2nd table.
I've partially solved this also using a data store with a parameter called key_list, where I add (I mean, concatenate) the key field for the selected row.
So, if I have a table with 4 rows with key fields "key1", "key2", "key3", the parameter key_list would get "key1;key2;key3".
So far, it's ok. But when I remove a row previosly added.... I can't remove the key from the key_list parameter. (I mean, from 2nd table I choose to remove the "key2" row, but I don't know how also remove the key name from the key_list)
I hope be clearly enough.
Any help will be really appreciated and point-rewarded.
Thanks again.
Best Regards
PS: is there any way of "mark" a row that has been added to the 2nd table? I mean, using (for example) a hidden boolean field named "added", that becomes true when the selected row is added to the 2nd table. -
How to display data in table with dynamic rows, section wise in a page.
Hello all,
I work on report creation in BI Publisher where I need to display data from xml in a table in pdf format.The output page is divided into two vertical sections , containing tables, with exactly same columns on left and right sections. The number of rows in table depends on the output of the fetching query. The page is to be populated in such a way that, at first, the left table is populated, then the next rows fill up the table on the right section of the page, if more rows are left, they fill up the tables on next page[first the left table, and then the right one, in a similar fashion as in page 1]
On a bird's eye view, the data needs to be simply mapped to a table, with dynamic number of rows, and so can span number of pages depending on size of data. On a implementation level, I am stuck in getting the left section of the page populated first, then the right section[in place of the right page], and then the next page.
Please guide me if someone has any idea in getting this achieved.
Thanks in advance.Thanks for the response...
I am able to get the desired functionality. I just need the tables to be inside a bigger table, that also has a dividing line between the two columns. This is was is intended in the req. provided to me. The column formatting option provides me a line ,but that is not further modifiable .Please help me in getting a perpendicular line between the two columns, which I need to be of a specified width and color. -
Assume I have process with 2 xfaForm variables, Form A (a PDF) and Form B (a PDF). A user fills out Form A. I want to populate values in Form B with the data from Form A.
When I try to assign a value (using SetValue) directly from form A to form B, it doesn't seem to work. That is ...
Location: /process_data/form_B/object/data/xdp/datasets/data/FormB/Value1
Expression: /process_data/form_A/object/data/xdp/datasets/data/FormA/Value1
It does work however when I use a temporary XML variable, say xml_data. That is, I move the data from Form A to xml_data, and the move the data from xml_data to Form B.
Why would this be? What is wrong with directly moving data between my xfaForms? What am I missing?Hi Brad Steele,
I'm new in ES, n have experienced the same problem that u had sometime ago of trying to pass values from FormA to FormB, can you please help me out on this one -
Loading Data into Table with Complex Transformations
Hello Guys
I am trying to load data into one of the Dimension table and it has quite a few Transformations and i created 6 temp tables
1. It has 7 Columns , Gets 935 rows based on where condition
2. It has 10 Columns , Gets 935 rows with but it has nulls in it i.e for column 1 there are 500 fields and columns 2 there are 300 etc ...
3 , 4 , 5 , 6 all the same as the 2 table
and at the end when i am trying to join all the temp tables with the Product_id into the target , which is in each temp table ...
I am Getting Error Saying Not Obeying Primary key Constraints i.e unique values are not been inserting into the Product_id Column of Target Table and the Job is running for Hours
and the main Problem comes at , some of the Columns have the same Product_id
Please help me
I have been Trying for 1 week and i am in Full pressure
Thanks
Sriks
Edited by: Sriks on Oct 16, 2008 6:43 PMHi,
If you are creating a warehouse and product_key is ur PK then it should come only once and so u might have to think ur logic in getting the data. To get over the isue u can disable the constraint and load with out the cosntraint, but i would have u look at the logic and make sure u have only 1 product_key in the table.
Regards
Bharath -
Comparing two columns in two tables using partial text strings and copying data between tables
I have two tables:
The Vendor table is supplied by a clothing manufacturer and lists product data by row with a column that contains a unique manufacturer ID, such as T5C4. In this table is a short product description and a long product description that I need to find and copy into the second table, Inventory.
The Inventory table is an export from our Magento store. Each row contains a unique inventory number in a column that includes but does not match the unique manufacturer ID from the Vendor table. For example, the unique inventory number could be T5C4-W12, or RED-T5C4W12 or some other variation.
For each product in Inventory, I need to find the matching product in Vendor, and then copy the short description and long description from Vendor to Inventory.
Any tips? Thanks!
KarlKarl,
Here's a start, as you requested.
The formula for Our Inventory Row is:
=IFERROR(MATCH("*"&A&"*", Our Inventory :: A, 0), "n/a")
The formula for Brief Description in the inventory table is:
=IFERROR(INDEX(ABC Products :: $A$1:$C$9,MATCH(ROW(), ABC Products :: $D, 0), 2), "n/a")
The formula for the Full description in the inventory table is:
=IFERROR(INDEX(ABC Products :: $A$1:$C$9,MATCH(ROW(), ABC Products :: $D, 0), 3), "n/a")
The Manufacturer's table knows the concise product numbers, so it has the ability to search the Inventory table for it's product id's using wildcards and it then displays the line number of the item in the inventory table. The Inventory table can then search the manufacturer's table for its row number and can reference the brief and full descriptions.
This approach has a serious limitation. It will only find the first occurrence in the inventory. Now, if you want to accept this, you can sort all the found descriptions and pull them out of the inventory table, and then the next product in line will display it's description too.
I wish I could do better with this, but it's all I can come up with at this point, knowing only what you have told me.
Jerry
Maybe you are looking for
-
I have Adobe Photoshop cs2 for windows.
Considering getting a Mac but first see if I have to purchase the one for Apple or will they let me convert from windows to a mac version
-
IPad iOS 6.1.2 update causing excessive battery drain
I have noticed in other discussions that a number of iPhone users have experienced excessive battery drain after updating to iOS 6.1.2. I am now experiencing this problem in a big way after updating to iOS 6.1.2 on an iPad 3. Prior to this update,
-
Error logging for Integrated Planning
Can I turn on error logging for Integrated Planning. Users get errors and forget to screenshot it to me, so I have no way of finding out what their error was unless I get them to duplicate it. It would be nice to look up a log of errors by user. D
-
Hi everybody I have two portlets in the same region, a form and a report of the same table. When I create a new element in the form, the report doesn't automatically update itself, is there a way to do this? Andrea
-
Watermark, color space, and transparency problem
I'm having a problem with inserting a watermark image into my pdfs. I created the watermark image in Photoshop. It is 8-bit gray with a transparent background. I saved it as a pdf (pdf 1.4 to allow transparency). The main pdfs (to be watermarked) are