Insert data from internal table to ztable.
Hello Expert,
I have a ztable with a primary key, now i want to pass my data from the internal table to the ztable . I am using modify option to
pass the data to the ztable but the problem is if the primary key value is same then its update the first record rather add one row in the zrable .But i want to push all the data what are available in the internal table though all the data are same. I even tried with Insert statement but its seems it doesnot work.
Can you please advice me the right approach.
Thanks.
Satya
Hi,
It is all about the primary key fields of the database table.
Example:
You have a db table with following fields
MANDT (primary key field)
BUKRS (primary key field)
BELNR (primary key field)
GJAHR
VBELN
and it with same fields.
MANDT BUKRS BELNR GJAHR VBELN
120 0010 160000 2008 450000
120 0010 160000 2007 450003
120 0020 160000 2008 450000
200 0010 160001 2008 450001
200 0010 160001 2007 450001
If you use INSERT statement, only 3 of these will be inserted into the database table, why?
Because: Each database table must include one or a very small group of key fields that uniquely identify each table line by its value. These fields are known as the primary keys of the table.
And as lines 1 and 2 / 4 and 5 have the same MANDT BUKRS and BELNR only one will be inserted into the table.
If the database table is your own one, you will need to modify it so that it would work.
Thankyou.
Regards,
Dhanalakshmi L
Similar Messages
-
[ECC6] Inserting data from internal table (deep structure) into db table
Hi experts,
I have a problem when inserting data from IT using deep structure into a database table. Please help:
I have one database table with 2 columns ZTest (col1, col2). Col1 is key.
In my program I have a deep structure t_screen using table type lvc_t_scol:
In 4.6c systems, the INSERT statement works well but it does not work in ECC6 systems.
DATA: BEGIN OF t_screen OCCURS 0,
rec_count(3) TYPE n,
col1 LIKE ZTest-col1,
col2 LIKE ZTest-col2.
DATA: ct TYPE lvc_t_scol.
DATA: END OF t_screen.
t_screen-col1 = 'test1'.
t_screen-col2 = 'test1'.
APPEND t_screen.
t_screen-col1 = 'test2'.
t_screen-col2 = 'test2'.
APPEND t_screen.
INSERT ZTest FROM TABLE t_screen ACCEPTING DUPLICATE KEYS.
Currently I have an idea using a temporary internal table with the same structure as ZTest. Use MOVE-CORRESPONDING statement to move data from t_screen table to temporary table before inserting --> It worked. But do you have any ideas without using temporary table?Hi
There are a large number of stataments couldn't be supported in unicode system and so it doesn't allow to do it in ECC 6.
U need to delete the deep structure from your defination:
DATA: BEGIN OF t_screen OCCURS 0,
rec_count(3) TYPE n,
col1 LIKE ZTest-col1,
col2 LIKE ZTest-col2.
DATA: ct TYPE lvc_t_scol. "<-------- Error is here
DATA: END OF t_screen.
So u need to use a structure like this to update your table:
DATA: BEGIN OF T_ZTEST OCCURS 0,
rec_count(3) TYPE n,
col1 LIKE ZTest-col1,
col2 LIKE ZTest-col2.
DATA: END OFT_ZTEST.
Max -
Question in ABAP syntax, read & insert data from internal table, while loop
Hi, SDN Fellow.
I am from Java background and learnt ABAP, I don't usually write much ABAP code.
I am trying to implement the following logic in a RFC now.
I have one z-custom database table, the structure as the following:
It has two columns, with these sample data.
Says datable table is ZEMPMGRTAB.
EmployeeID,ManagerID
user10,user1
user9,user1
user8,user1
user7,user2
user6,user2
user5,user2
user4,user2
user2,user1
The logic is this:
I have a input parameter, userid. I am using this parameter to have a select statement to query the record into export table,EXPTAB 'LIKE' table ZEMPMGRTAB.
SELECT * FROM ZEMPMGRTAB
into table EXPTAB
WHERE EMPLOYEEID = USERID.
Say, my parameter value, USERID ='USER4'.
Referring to the sample data above, I can get the record of this in my EXPTAB,
EmployeeID,ManagerID
user4,user2
Now, I want to iterately use the EXPTABLE-ManagerID
as the USERID input in SELECT statement, until it has no return result. Then, insert the new records in
EXPTAB.
In above new loop case, we will get this table content in EXPTAB,
EmployeeID,ManagerID
user4,user2
user2,user1
I kind of think of the pseudocode logic as below:
(These may not be a valid ABAP code, so I need help to convert/correct them)
DATA:
IWA TYEP ZZEMPMGRTAB,
ITAB
HASHED TABLE OF ZZEMPMGRTAB
WITH UNIQUE KEY EMPLOYEEID.
SELECT * FROM ZEMPMGRTAB
into table ITAB
WHERE EMPLOYEEID = USERID.
*Question 1: I cannot insert a internal table to export table, it is *incompatible type, what is the alternative way fo this?
*Question 2: How can I access thedata of the internal table like this,ITAB-MANAGERID? As if I can, I would do this:
* IWA-EMPLOYEEE = ITAB-EMPLOYEEID. IWA-MANAGERID = IWA-MANAGERID. INSERT IWA INTO TABLE EXPTAB.
* Question 3: Is the 'NE NULL' - 'not equal to NULL' is right syntax?
IF ITAB NE NULL.
INSERT ITAB INTO EXPTAB.
ENDIF
* Question 4: Is my WHILE loop setup right here? And are the syntax right?
WHILE ITAB NE NULL.
SELECT * FROM ZEMPMGRTAB
into table ITAB
WHERE EMPLOYEEID = ITAB-MANAGERID.
IF ITAB NE NULL.
INSERT ITAB INTO EXPTAB.
ENDIF
REFRESH ITAB.
ENDWHILE.
Assume all the syntax and logic are right, I should get this result:
EmployeeID,ManagerID
user4,user2
user2,user1
If I have a new entry in datable table,ZEMPMGRTAB like this:
user1,user0
My pseudocode logic will get this result:
EmployeeID,ManagerID
user4,user2
user2,user1
user1,user0
I truly appreciate if you can help me to validate the above syntax and pseudocode logic.
Thanks in advance.
KCHi,
FUNCTION ZGETSOMEINFO3.
*"*"Local Interface:
*" IMPORTING
*" VALUE(USERID) TYPE AWTXT
*" VALUE(FMTYPEID) TYPE AWTXT
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRETURN
*" TABLES
*" APPROVERT STRUCTURE ZTAB_FMAPPROVER
*" ACTOWNERT STRUCTURE ZTAB_FMACTOWNER
DATA: T_RESULT TYPE STANDARD TABLE OF ZTAB_FMAPPROVER.
**Question 1: For this line, I got an error says "Program ''USERID" *not found. Is the syntax right, as the USERID is a parameter for the function.
perform add_line(USERID).
ENDFUNCTION.
form add_line using i_user type ZTAB_FMAPPROVER.EMPLOYEEID
changing T_RESULT TYPE ZTAB_FMAPPROVER.
data: ls_row type ZTAB_FMAPPROVER.
* Get record for i_user
select single * into ls_row from ZTAB_FMAPPROVER
where EmployeeID = i_user.
if sy-subrc NE 0.
* Do nothing, there is not manager for this employee
else.
* Store result
QUESTION 2: I am still got stuck on this line of code. It still *says that "T_RESULT" is not an internal table "OCCURS n" *specification is missing. I thought the line: "T_RESULT TYPE *ZTAB_FMAPPROVER" means declare internal table, T_RESULT as type of ZTAB_FMAPPROVER". Am I understand it wrongly?
append ls_row to t_result.
* Call recursion
perform add_line using ls_row-ManagerID
changing t_result.
endif.
endform.
Thanks,
KC -
Inserting records from internal table to database table
Hi all,
i want to insert records from internal table to zDatabase table, can u plz guide me which statement is better in performance to insert the records.
1) insert one by one record from internal table
loop at itab.
insert ztable from wa.
endloop.
2) insert total records at a time
INSERT <dbtabname> CLIENT SPECIFIED FROM TABLE itab.
or let me know if any other statement is there with high performance.
i internal table contains nearly 40000 records.
thanks.Hi,
Insert the entire table at atime rather than a record so as to increase the performance.
you can use INSERT <dbtabname> CLIENT SPECIFIED FROM TABLE itab.
or
MODIFY ZPRODUCT FROM TABLE GI_AFPO.
Regards,
Raj. -
How to send data from internal table to the shared folder in ABAP
Hi experts,
My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is "
xxx\y\z....".
I do not have any idea on how to send data from internal table to the shared folder path.
can anybody please help me out how to do this?
Thanks & Regards
Sireesha.Where that folder is located, its on presentation server i.e. desktop or application server.
If its on presentation server, use FM GUI_UPLOAD.
If its on application server, then use DATASET functions. Have a look at below link.
[File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
I hope it helps.
Thanks,
Vibha
Please mark all the useful answers -
Gui_download for transferring the data from internal table to excel sheet.
hi all,
i am using gui_download for transferring the data from internal table to excel sheet.
I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
Thanks in advance.Hi Venkata,
plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
call function 'SAP_CONVERT_TO_XLS_FORMAT'
exporting
* I_FIELD_SEPERATOR =
* I_LINE_HEADER =
i_filename = p_file
* I_APPL_KEEP = ' '
tables
i_tab_sap_data = t_mbew
* CHANGING
* I_TAB_CONVERTED_DATA =
* EXCEPTIONS
* CONVERSION_FAILED = 1
* OTHERS = 2
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Hope this helps,
Erwan -
Downloading data from internal table to xls file leading zeros are not disp
Hai abap gurus,
when i am downloading data from internal table to excle file. some field values in a column are with leading zeros and some others dont have leading zeros.but in the output it is showing without leading zeros. then how to get with exact values.
Ex:
<b>ECC Code.</b>
045234
88567
098456
but output is giving like this:
45234
88567
98456
how to get the actual values.....
plz help me in this matter.Dear Kiran,
Those field in the internal table having Leading Zeroes, make those fields' datatype as character.
Then use the function module to download the content of the internal table to the excel file.
Regards,
Abir
Don't forget to Reward Points * -
Download data from internal table to flat file.
I need to download the data from Internal table to Flat file. can any one suggest how to do it? i suppose WS_Download OR GUI_DOWNLOAD.
but if it is please guide me how to use this.
is thre any other F.M. please provide the information.
Thanks in advanceHi,
Try this,
* File download, uses older techniques but achieves a perfectly
* acceptable solution which also allows the user to append data to
* an existing file.
PARAMETERS: p_file like rlgrap-filename.
* Internal table to store export data
DATA: begin of it_excelfile occurs 0,
row(500) type c,
end of it_excelfile.
DATA: rc TYPE sy-ucomm,
ld_answer TYPE c.
CALL FUNCTION 'WS_QUERY'
EXPORTING
query = 'FE' "File Exist?
filename = p_file
IMPORTING
return = rc.
IF rc NE 0. "If File alread exists
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
* TITLEBAR = ' '
* DIAGNOSE_OBJECT = ' '
text_question = 'File Already exists!!'
text_button_1 = 'Replace'
* ICON_BUTTON_1 = ' '
text_button_2 = 'New name'
* ICON_BUTTON_2 = ' '
* DEFAULT_BUTTON = '1'
* DISPLAY_CANCEL_BUTTON = 'X'
* USERDEFINED_F1_HELP = ' '
* START_COLUMN = 25
* START_ROW = 6
* POPUP_TYPE =
IMPORTING
answer = ld_answer
* TABLES
* PARAMETER =
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
* Option 1: Overwrite
IF ld_answer EQ '1'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = p_file "File Name
filetype = 'ASC'
* IMPORTING
* FILELENGTH =
TABLES
data_tab = it_excelfile "Data table
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i003(zp) WITH
'There was an error during Excel file creation'(200).
exit. "Causes short dump if removed and excel document was open
ENDIF.
* Option 2: New name.
ELSEIF ld_answer EQ '2'.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
filename = p_file "File name
filetype = 'ASC' "File type
* col_select = 'X' "COL_SELECT
* col_selectmask = 'XXXXXXXXXXXXXXXXXXXXXXXXXX'
* "COL_SELECTMASK
filetype_no_show = 'X' "Show file type selection?
* IMPORTING
* act_filename = filename_dat
TABLES
data_tab = it_excelfile "Data table
* fieldnames =
EXCEPTIONS
file_open_error = 01
file_write_error = 02
invalid_filesize = 03
invalid_table_width = 04
invalid_type = 05
no_batch = 06
unknown_error = 07.
ENDIF.
ELSE. "File does not alread exist.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = p_file "File name
filetype = 'ASC' "File type
* IMPORTING
* FILELENGTH =
TABLES
data_tab = it_excelfile "Data table
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE i003(zp) WITH
'There was an error during Excel file creation'(200).
exit. "Causes short dump if removed and excel document was open
ENDIF.
ENDIF.
Regards,
Raghav -
Convert data from internal table to XML file.
Hi All,
I am selecting data from database into one internal table.
Now I want to convert data from internal table to xml file format and save in to my desktop. Please suggest me how I can achieve my requirement.
Kindly reply me ASAP.Use this FM. SAP_CONVERT_TO_XML_FORMAT
Check this link too -
Re: Data Export in XML format
XML files from ABAP programs -
Reading Data from Internal Table
Hi,
Can anyone please tell me how to read data from Internal Tables in the Event Handler without using the Select statement OnInitialization?
Thanks,
GauravHi Siddhartha,
Can you tell me the problem in my code. I tried to work on the way you suggested. Though I have not finished with the coding, I just wanted to know whether I am going in the direction or not.
I have declared the the structure in Type Defination as
TYPES: BEGIN OF TEST_STRUC,
BEGDA TYPE BEGDA,
ENDDA TYPE ENDDA,
END OF TEST_STRUC.
TYPES: TEST_TAB_TYPE TYPE TABLE OF TEST_STRUC.
In the Event Handler, I have added the following code on OnInputProcessing:
event handler for checking and processing user input and
for defining navigation
DATA TEST_INFO LIKE LINE OF TEST_TAB.
DATA: MYTAB6 TYPE TABLE OF PA0006,
MYTAB6_WA LIKE LINE OF MYTAB6.
REFRESH TEST_TAB.
CLEAR TEST_INFO.
MYTAB6_WA-BEGDA = REQUEST->GET_FORM_FIELD( STARTDATE ).
MYTAB6_WA-ENDDA = REQUEST->GET_FORM_FIELD( ENDDATE ).
IF EVENT->NAME EQ 'button'
AND EVENT->SERVER_EVENT EQ 'click'.
LOOP AT MYTAB6 INTO MYTAB6_WA.
TEST_INFO-BEGDA = MYTAB6_WA-BEGDA.
TEST_INFO-ENDDA = MYTAB6_WA-ENDDA.
ENDLOOP.
APPEND TEST_INFO TO TEST_TAB.
CLEAR TEST_INFO.
NAVIGATION->SET_PARAMETER( NAME = 'test_tab'
VALUE = 'begda' ).
NAVIGATION->SET_PARAMETER( NAME = 'test_tab'
VALUE = 'endda' ).
NAVIGATION->GOTO_PAGE( 'MyBSP2.htm').
ENDIF.
P.S. MyBSP2.htm is my next page.
Thanks,
Gaurav -
Upload data from Internal table to text file with '~' separator
can anyone help me to download data from internal table to flat file with '' separator. GUI_DOWNLOAD is not working in my case ....like for '' separator
Here it is
REPORT zkb_test1.
TYPE-POOLS: truxs.
DATA: i_scarr TYPE TABLE OF scarr,
i_conv_data TYPE truxs_t_text_data.
SELECT * FROM scarr INTO TABLE i_scarr.
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
i_field_seperator = '~'
TABLES
i_tab_sap_data = i_scarr
CHANGING
i_tab_converted_data = i_conv_data
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = 'C:\Test1.txt'
filetype = 'ASC'
CHANGING
data_tab = i_conv_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards
Kathirvel -
Hash lookup or Binary search to fetch data from internal table
Hi All,
I want to know Which is faster, Hash lookup or Binary search to fetch data from internal tables?
Thanks,
Mahesh
Moderator Message: Duplicate post
Edited by: kishan P on Oct 14, 2010 4:22 PMtype mod* .the the sign would change to pattern.try and see.i checked.reward if works.
-
Inserting data from a table to an XML file
I want to insert the values from this xml file emp.xml into a table Employees :
<EMPLOYEES>
<EMP>
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<HIREDATE>17-DEC-80</HIREDATE>
<SAL>800</SAL>
</EMP>
<EMP>
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<HIREDATE>20-FEB-81</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
</EMP>
<EMP>
</EMPLOYEES>
and here is my Employee table in Oracle 9i database
SQL> DESC EMPLOYEE;
Name Null? Type
EMPNO NUMBER
EMPNAME VARCHAR2(10)
JOB VARCHAR2(10)
HIREDATE DATE
SAL NUMBER
After getting help from the members i was able to do the insert of data from the xml file to the table..how to do the insert of data from the table to the xml file.
Regards,
RenuHello michaels , thank you for the solution, still i am having some problems
Here is what i have done :
1.
SQL> CREATE DIRECTORY my_table_dir AS 'E:\table_files'
2 ;
Directory created.
2.
SQL> select * from myemp;
ENAME
SMITH
ALLEN
3.
This is the content of the existing xml file saved in the directory E:\table_files as emp.xml
<EMPLOYEES>
<EMP>JIM</EMP>
<EMP>RICK</EMP>
</EMPLOYEES>
4.
Now i executed this code :
declare
emp_xml xmltype;
begin
select sys_xmlagg (column_value, sys.xmlformat ('EMPLOYEES')) emp_xml
into emp_xml
from table (xmlsequence (cursor (select *
from myemp
where ename in ('SMITH', 'ALLEN')),
sys.xmlformat ('EMP')
dbms_xslprocessor.clob2file (emp_xml.getclobval (), 'E:\table_files', 'emp.xml');
end;
And the Error i got is :
declare
ERROR at line 1:
ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 18
ORA-06512: at "SYS.UTL_FILE", line 424
ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 46
ORA-06512: at line 12 -
<p style="margin-top: 0; margin-bottom: 0"><font face="Arial" size="2">Hi,</font></p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Arial" size="2">I would
like to insert data in a table. The data are selected by a query. I wrote this
code but there is an error :</font></p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font><font face="Courier New">
<font SIZE="2" COLOR="#0000f0">PROCEDURE</font><font SIZE="2"> </font>
<font SIZE="2" COLOR="#808000">GLMASTER_SAVE</font><font SIZE="2"> </font>
</font><font SIZE="2" COLOR="#0000f0"><font face="Courier New">IS</font></p>
</font><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" COLOR="#0000f0" face="Courier New">BEGIN</p>
</font>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier New">
<font SIZE="2" COLOR="#0000f0"> INSERT</font><font SIZE="2"> </font>
<font SIZE="2" COLOR="#0000f0">INTO</font><font SIZE="2"> </font></font>
<font SIZE="2" COLOR="#808000"><font face="Courier New">GLMASTER_SAVE</font></p>
</font>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#0000f0" face="Courier New"> </font><font SIZE="2" COLOR="#0000f0" face="Courier New">
</font><font SIZE="2" COLOR="#0000f0" face="Courier New"> </font><font SIZE="2" COLOR="#0000f0" face="Courier New">
</font><font face="Courier New"><font SIZE="2" COLOR="#0000f0">(</font><font SIZE="2">COMPANY</font><font SIZE="2" COLOR="#0000f0">,</font><font SIZE="2">
ACCT_UNIT</font><font SIZE="2" COLOR="#0000f0">,</font><font SIZE="2"> ACCOUNT</font><font SIZE="2" COLOR="#0000f0">,</font><font SIZE="2">
SUB_ACCOUNT</font><font SIZE="2" COLOR="#0000f0">,</font><font SIZE="2">
ACTIVE_STATUS</font></font><font SIZE="2" COLOR="#0000f0"><font face="Courier New">)</font></p>
</font><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" COLOR="#0000f0" face="Courier New"> </font><font SIZE="2" COLOR="#0000f0" face="Courier New">
VALUES</p>
</font><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" COLOR="#0000f0" face="Courier New"> </font><font SIZE="2" COLOR="#0000f0" face="Courier New">
</font><font SIZE="2" COLOR="#0000f0" face="Courier New"> </font><font SIZE="2" COLOR="#0000f0" face="Courier New">
</font><font face="Courier New"><font SIZE="2" COLOR="#0000f0">(SELECT</font><font SIZE="2">
</font><font SIZE="2">COMPANY</font><font SIZE="2" COLOR="#0000f0">,</font><font SIZE="2">
</font><font SIZE="2">ACCT_UNIT</font><font SIZE="2" COLOR="#0000f0">,</font><font SIZE="2">
</font><font SIZE="2">ACCOUNT</font></font><font SIZE="2" COLOR="#0000f0"><font face="Courier New">,</font></font><font SIZE="2"><font SIZE="2" COLOR="#0000f0" face="Courier New">
</font></font><font face="Courier New"><font SIZE="2">SUB_ACCOUNT</font><font SIZE="2" COLOR="#0000f0">,</font><font SIZE="2">
</font></font><font SIZE="2"><font face="Courier New">ACTIVE_STATUS</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#0000f0" face="Courier New"> </font><font SIZE="2" COLOR="#0000f0" face="Courier New">
</font><font SIZE="2" COLOR="#0000f0" face="Courier New"> </font><font SIZE="2" COLOR="#0000f0" face="Courier New">
</font><font SIZE="2" COLOR="#0000f0" face="Courier New"> </font><font SIZE="2" COLOR="#0000f0" face="Courier New">
</font><font SIZE="2" COLOR="#0000f0" face="Courier New"> </font></font><font face="Courier New"><font SIZE="2" COLOR="#0000f0">FROM</font><font SIZE="2">
</font></font><font SIZE="2"><font face="Courier New">GLMASTER</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#0000f0" face="Courier New"> </font><font SIZE="2" COLOR="#0000f0" face="Courier New">
</font><font SIZE="2" COLOR="#0000f0" face="Courier New"> </font></font><font face="Courier New"><font SIZE="2" COLOR="#0000f0">ORDER</font><font SIZE="2">
</font><font SIZE="2" COLOR="#0000f0">BY</font><font SIZE="2"> </font>
<font SIZE="2">COMPANY</font><font SIZE="2" COLOR="#0000f0">,</font><font SIZE="2">
</font><font SIZE="2">ACCT_UNIT</font><font SIZE="2" COLOR="#0000f0">,</font><font SIZE="2">
</font><font SIZE="2">ACCOUNT</font><font SIZE="2" COLOR="#0000f0">,</font><font SIZE="2">
</font><font SIZE="2">SUB_ACCOUNT</font></font><font SIZE="2" COLOR="#0000f0"><font face="Courier New">);</font></p>
</font><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0">
<font SIZE="2" COLOR="#0000f0" face="Courier New"> </font><font SIZE="2" COLOR="#0000f0" face="Courier New">
</font></font><font SIZE="2" COLOR="#0000f0" face="Courier New">COMMIT;</p>
</font><font SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font SIZE="2" COLOR="#0000f0" face="Courier New">END;</p>
</font>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Arial" size="2">Do you
know why ?</font></p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Arial" size="2">Thank you
for your help.</font></p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0">
<font color="#008080" face="Arial" size="2"><i><b>Patrick</b></i></font></p>try this:
INSERT INTO GLMASTER_SAVE
(COMPANY, ACCT_UNIT, ACCOUNT, SUB_ACCOUNT, ACTIVE_STATUS)
SELECT COMPANY, ACCT_UNIT, ACCOUNT, SUB_ACCOUNT, ACTIVE_STATUS
FROM GLMASTER
ORDER BY COMPANY, ACCT_UNIT, ACCOUNT, SUB_ACCOUNT;you need not to include the VALUES
Message was edited by:
Warren Tolentino
sorry ps while posting this you had already posted your solution. -
Simple way to insert data from one table
Hi,
I need to know a simple way on how to transfer the data from one table to another....
First table xx_inv_tab1 has three columns col1, col2, col3 and where as second table xx_inv_tab2 has five columns col1, col2, col3, col4, col5.
Here col2, col3, col4 are the same columns as in table1 xx_inv_tab1...
Now I want to transfer first table data in to second table .... first column of second table holds a sequence, followed by the first table three columns data and followed with col4 and col5 which will hold NULL values....
In my scenario, I have 70 - 75 columns in my first table which I want to move to second table which three new columns (one is sequence and other two has null values)...
Any ideas if we make it in a simplest way rather saying insert into xx_inv_tab2 (col1, col2, col3 ............................................. col75) values (seq, col1, col2..........................col75, null, null)
Help Appreciated..
ThanksEasy
untested
insert into xx_inv_tab2 t2 (col1,col2,col3,col4)
select yourSequence.nextval, t1.col1, t1.col2, t1.col3
from xx_inv_tab1 t1
;Note that col5 does not need to be used, since you want to fill it with NULL.
USe excel or sql developer to write you a list of column names, if you are to lazy to write all 75 columns by yourself.
What might also work:
untested
insert into xx_inv_tab2 t2
select yourSequence.nextval, t1.*, null
from xx_inv_tab1 t1
;Edited by: Sven W. on Aug 31, 2012 4:41 PM
Maybe you are looking for
-
Ever since I installed Snow Leopard (10.6.8) a month ago, the masking function in QuickTime 7Pro (v. 7.6.6) stopped working. Masks disappeared in old videos where I had previously and successfully added a mask, and I could not longer use QT 7Pro to
-
Hp DV6 GPU 2 Overheatin​g
Hey Guys. i Have This HP Pavillion DV6-6100SE(AMD A6-3410MX). I Had The HeatSink Replaced 6 Months Ago From Hp Because I Was Having Heating Problem. Now It Is Even Worse Than Before. It Has two GPU's. AMD 6755G2. The Gpu2 Is Going At 91 Degree Idle.
-
Somebody knows why I hit a run time engine error when I select runtime adapter in teststand? If I choose dev environment, there is no error and the vi executes. Attachments: RunTimeError.png 194 KB
-
Flash Builder fort All Devices
hello Am new for flash builder i want to create games for pc,iphone,ipod etc. it is possible in single project Currently am flash game developer using cs5 and as2,as3
-
Flash CS3 Pro Ver 9.02???
Hi there, I just installed a update ver 9.02 of my flash cs3. However, it's still loading ver 9.0 in my loading screen.... Any ideas?? Thanks! d