Combine 2 rows into 1 row
Hi,
I'm not sure if this is possible or not, but I have 2 different columns in a display page- 1 for PNR Initials and 1 for BOM Initials, but when I insert everything into the database, I only have 1 column to handle both the PNR and BOM initials. The way I tell them apart is with another column that is called Document_Type. If it says "PNR Req", then I know to output it into the PNR Initials column. If it says "BOM Req", then I know to outupt it into the BOM Initials column.
Although the inserting works correctly, the display page does not put them next to each other since the data is dynamic and it's outputting each column's initials into their own rows. For instance, I updated the PNR Initial to "VP" and hit the update or insert button and it inserted the PNR Initial into the database. Then I went back to the display page to insert the BOM Initial to "AG". It inserted it correctly. But now when I go back to the display page, there are 2 different rows with the first row that has the drop down menu in the PNR Column and "AG" in the BOM column. But then there is another row that has "VP" in the PNR column and the drop down menu in the BOM column. Since I've updated both columns, it should just show the PNR Initials under the PNR column once and the BOM Initials under the BOM column once, but all in the same row and not on 2 separate rows. How do I get it so they show up on the same row? The 2 different rows are indicated by the APVID 5 and 9, but they both are linked to the same item number 5 in the Items table. Here's what my display page looks like now:
APVID
APV_ItemID
Part_Number
PNR
BOM
5
5
aaa5
Drop Down Menu
AG
9
5
aaa5
VP
Drop Down Menu
It should look like this:
APVID
APV_ItemID
Part_Number
PNR
BOM
5 and 9
5
aaa5
VP
AG
The APV_ItemID is linked to a column in another table. That table is the ECO_Items table that has the ItemID column that has all the items. The info. above for the APV_ItemID and Part number can always all be the same, but the PNR and BOM columns have to display the correct initals in each on 1 line. I tried the maxrows and the group function on the output query, but those did not work. I've also tried some IF statements, but they do not work either. Any other ideas? Is this even possible?Thanks.
Andy
Ilssac or Dan,
I have tried every possible way with If statements and Or's and And's and I still cannot get this to work exactly right. I think it's because in my database I have a column that says Document_Type. In this column I say whether or not that line item is a PNR Req or a BOM Req. But when I go to output it into a table on the web page, I want it displayed into 2 columns- 1 for PNR and 1 for BOM. I also want it so that if the initials are already in the database, then just output them, and if they aren't then output a drop down menu. I am really close to getting it to work correctly. I have it working so that both the PNR and BOM columns display the initials if they are filled in. I also have it working so that if there are no initials for that line item at all, then output drop down menus. Where I run into the problem is when I have a PNR Initial filled in, but there isn't a BOM initial filled in, and it should display a drop down menu to fill out the BOM initial. This doesn't work though because I have an If statement that says if the Document_Type equals PNR or BOM then output the initial (which it does under the PNR column for instance), else put the drop down. But since I have the Document_Type that says PNR Req for that line item already, it thinks it doesn't need to put the drop down under the BOM column, but I do need it there. I just don't know what else to try with this. Below is what I have for my code, but I just can't get the drop downs to show up in the BOM column if there is a PNR initial filled out already. I've tried keeping both columns separate in my code, but I can't because of the way the database is designed. I can also remove the TD tags, but I still have the same problem with the BOM drop down not showing up if there is a PNR initial in there already. Does this make any sense? Do you guys have any other ideas for me to try? Thanks.
<table width=*% align="center" cellspacing="0" cellpadding="4" border="0">
<tr>
<td><B>ECO</B> </td>
<!--- <td><B>ECO ItemID</B> </td> --->
<td><B>APVID</B> </td>
<td><B>APV ItemID</B></td>
<td><B>Part Number </B></td>
<td align="center"><B>PNR</B></td>
<td align="center"><B>BOM</B></td>
<!--- <td align="center"><B>Open Jobs Affected</B></td> --->
</tr>
<cfform name="EditItem" method="post" action="Queue_PNR_BOM_action.cfm">
<CFOUTPUT QUERY="PNRBOMSearch" group="ItemID">
<CFOUTPUT group="APV_ItemID">
<tr>
<td>
<cfif ECID is not "">
<a href="item_display.cfm?ECID=#ECID#">#ECID#</a>
<cfelse>
</cfif></td>
<td>
#APVID#
</td>
<td>
#APV_ItemID#
</td>
<td width="auto">
<cfif Part_Number Is Not "">
#Part_Number#
<cfelse>
</cfif></td>
<CFOUTPUT>
<cfif Document_Type EQ "PNR Req" or Document_Type EQ "BOM Req">
<td align="center">#Approval_Initials#</td>
<cfelseif Document_Type NEQ "PNR Req" or Document_Type NEQ "BOM Req">
<td align="center">
<select name="PNR_Approval_Initials#ItemID#">
<option value="">PNR Initials</option>
<cfloop query="ShowInitials">
<cfif Engineer_Initials EQ 1>
<option value="#Initials#">#Initials#</option>
</cfif>
</cfloop>
</select>
</td>
<td align="center">
<select name="BOM_Approval_Initials#ItemID#">
<option value="">BOM Initials</option>
<cfloop query="ShowInitials">
<cfif Engineer_Initials EQ 1>
<option value="#Initials#">#Initials#</option>
</cfif>
</cfloop>
</select>
</td>
</cfif>
</cfoutput>
</tr>
</cfoutput>
</cfoutput>
<tr>
<td colspan="4" align="center">
<input type="submit" value="Update">
<input type="reset" value="Reset"></td>
</tr>
</table>
<cfoutput>
<input type="hidden" name="listofids" value="#ValueList(PNRBOMSearch.ItemID)#">
</cfoutput>
</cfform>
andy
Similar Messages
-
How to combine many rows into one row
Hi all,
I have a question regarding to how to combine many rows into one row?
My result set is like that:
ITEM_NO NAME1
11 abc
11 cde
11 fg
Want to combine them into
ITEM_NO NAME1
11 abc;cde;fg
would anybody can tell me how to do that? Thanks
RayYou can check this --
satyaki>
satyaki>
satyaki>create table t
2 as
3 select 11 ITEM_NO, 'abc' NAME1 from dual
4 union all
5 select 11 ITEM_NO, 'cde' NAME1 from dual
6 union all
7 select 11 ITEM_NO, 'fg' NAME1 from dual;
Table created.
satyaki>
satyaki>
satyaki>
satyaki>set lin 10
satyaki>
satyaki>desc t;
Name Null? Type
ITEM_NO NUMBER
NAME1 VARCHAR2(3)
satyaki>
satyaki>
satyaki>set lin 1000
satyaki>
satyaki>
satyaki>
satyaki>SELECT ITEM_NO,
2 LTRIM(MAX(SYS_CONNECT_BY_PATH(NAME1,';'))
3 KEEP (DENSE_RANK LAST ORDER BY curr),';') AS NAME1_DET
4 FROM (SELECT ITEM_NO,
5 NAME1,
6 ROW_NUMBER() OVER (PARTITION BY ITEM_NO ORDER BY NAME1) AS curr,
7 ROW_NUMBER() OVER (PARTITION BY ITEM_NO ORDER BY NAME1) -1 AS prev
8 FROM t)
9 GROUP BY ITEM_NO
10 CONNECT BY prev = PRIOR curr AND ITEM_NO = PRIOR ITEM_NO
11 START WITH curr = 1;
ITEM_NO NAME1_DET
11 abc;cde;fgRegards.
Satyaki De. -
How to combine many rows into 1 rows in 1 column?
Hi all,
I have a question regarding to how to combine many rows into one row?
My result set is like that:
ITEM_NO NAME1
11 abc
11 cde
11 fg
Want to combine them into
ITEM_NO NAME1
11 abc;cde;fg
would anybody can tell me how to do that? Thanks
RayHi,
select * from x2;
INO NAME
13 PQR
11 ABC
11 DEF
12 JKL
12 MNO
11 GHI
select p.ino as ITEMNO,
substr(max(substr(sys_connect_by_path (p.name,';'),2)),1,60) as ITEMNAME
from (select ino,name,
row_number()over (partition by ino order by ino, name) rn
from x2) p
start with p.rn = 1
connect by p.rn = prior p.rn + 1
and prior p.ino = p.ino
group by ino;
OP
ITEMNO ITEMNAME
11 ABC;DEF;GHI
12 JKL;MNO
13 PQR cheers
Nirmal -
Combine 2 rows into single row?
I have a table A which has information related to a process. For process completion there exist 2 rows. One has in it the total elapsed time, the time the entire process (which is multipart) begin and end time, but the columns related to rows processed are blank. Another related row has a start, end and elapsed time in it -- which I don't want -- but it has the row counts that I do want.
I want to take these 2 rows, combine the relevant information into 1 row and insert that row into table B.
I know I could insert from the first row and then come back and update it from the second row, but I hate having to read Table A twice. Any suggestions?Hello
Is it not just a matter of using group by with sum? I may well have missed an important detail but here's a starting point:
SQL> CREATE TABLE DT_TEST_PROCESS
2 ( id number,
3 stage number,
4 rows_processed number,
5 elapsed number
6 )
7 /
Table created.
SQL>
SQL> INSERT INTO dt_test_process
2 VALUES(1,1,100,0)
3 /
1 row created.
SQL> INSERT INTO dt_test_process
2 VALUES(1,2,0,10)
3 /
1 row created.
SQL> INSERT INTO dt_test_process
2 VALUES(2,1,1000,0)
3 /
1 row created.
SQL> INSERT INTO dt_test_process
2 VALUES(2,2,0,20)
3 /
1 row created.
SQL>
SQL> INSERT INTO dt_test_process
2 VALUES(3,1,500,0)
3 /
1 row created.
SQL> INSERT INTO dt_test_process
2 VALUES(3,2,0,30)
3 /
1 row created.
SQL>
SQL> SELECT
2 id,
3 SUM(rows_processed) total_rows,
4 SUM(elapsed) total_elapsed
5 FROM
6 dt_test_process
7 GROUP BY
8 id
9 /
ID TOTAL_ROWS TOTAL_ELAPSED
1 100 10
2 1000 20
3 500 30
SQL>
SQL> CREATE TABLE dt_test_process_sum AS
2 SELECT
3 id,
4 SUM(rows_processed) total_rows,
5 SUM(elapsed) total_elapsed
6 FROM
7 dt_test_process
8 GROUP BY
9 id
10 /
Table created.HTH
David -
How to combine 2 table rows into 1
Hi,
I have an interesting situation where I have two table rows which represent the same row but with a different set of attributes, and I want to combine these two rows into one row for display with in my ADF table. Is there a way that I can manipulate my table data to do this before it is rendered within my table?
As an example I have:
Name | Type | Attribute
T1 A blue
T1 A red
T2 B green
Instead of displaying the above I would like to display
Name | Type | Attribute
T1 A blue, red
T2 B greenAny help is appreciated,
-Wraith
Edited by: wraith101 on Oct 8, 2012 2:42 PMFrank,
create a database view that calls a stored function to parse the duplicate values into a comma separate string and then built the ADF BC entity and view on top of this. This issue is not really one that should be fixed on the >model or UI layer. Building entity view is not a good idea, as all views are not update able, and in this scenario it would'nt be. -
Need help with turning multiple rows into a single row
Hello.
I've come across a situation that is somewhat beyond my knowledge base. I could use a little help with figuring this out.
My situation:
I am attempting to do some reporting from a JIRA database. What I am doing is getting the dates and times for specific step points of a ticket. This is resulting in many rows per ticket. What I need to do is return one row per ticket with a calculation of time between each step. But one issue is that if a ticket is re-opened, I want to ignore all data beyond the first close date. Also, not all tickets are in a closed state. I am attaching code and a sample list of the results. If I am not quite clear, please ask for information and I will attempt to provide more. The database is 10.2.0.4
select jiraissue.id, pkey, reporter, summary
,changegroup.created change_dt
,dbms_lob.substr(changeitem.newstring,15,1) change_type
,row_number() OVER ( PARTITION BY jiraissue.id ORDER BY changegroup.created ASC ) AS order_row
from jiraissue
,changeitem, changegroup
,(select * from customfieldvalue where customfield = 10591 and stringvalue = 'Support') phaseinfo
where jiraissue.project = 10110
and jiraissue.issuetype = 51
and dbms_lob.substr(changeitem.newstring,15,1) in ('Blocked','Closed','Testing','Open')
and phaseinfo.issue = jiraissue.id
and changeitem.groupid = changegroup.id
and changegroup.issueid = jiraissue.id
order by jiraissue.id,change_dt
Results:
1 21191 QCS-91 Error running the Earliest-deadlines flight interface request/response message 2008-07-16 9:30:38 AM Open 1
2 21191 QCS-91 Error running the Earliest-deadlines flight interface request/response message 2008-07-16 11:37:02 AM Testing 2
3 21191 QCS-91 Error running the Earliest-deadlines flight interface request/response message 2010-06-08 9:14:52 AM Closed 3
4 21191 QCS-91 Error running the Earliest-deadlines flight interface request/response message 2010-09-02 11:29:37 AM Open 4
5 21191 QCS-91 Error running the Earliest-deadlines flight interface request/response message 2010-09-02 11:29:42 AM Open 5
6 21191 QCS-91 Error running the Earliest-deadlines flight interface request/response message 2010-09-02 11:29:50 AM Testing 6
7 21191 QCS-91 Error running the Earliest-deadlines flight interface request/response message 2010-09-02 11:29:53 AM Closed 7
8 23234 QCS-208 System Baseline - OK button does not show up in the Defer Faults page for the System Engineer role 2008-10-03 10:26:21 AM Open 1
9 23234 QCS-208 System Baseline - OK button does not show up in the Defer Faults page for the System Engineer role 2008-11-17 9:39:39 AM Testing 2
10 23234 QCS-208 System Baseline - OK button does not show up in the Defer Faults page for the System Engineer role 2011-02-02 6:18:02 AM Closed 3
11 23977 QCS-311 Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks 2008-09-29 2:44:54 PM Open 1
12 23977 QCS-311 Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks 2010-05-29 4:47:37 PM Blocked 2
13 23977 QCS-311 Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks 2011-02-02 6:14:57 AM Open 3
14 23977 QCS-311 Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks 2011-02-02 6:15:32 AM Testing 4
15 23977 QCS-311 Tally Sheet - Reason Not Done fails to provide reason for unassigned tasks 2011-02-02 6:15:47 AM Closed 5Hi,
Welcome to the forum!
StblJmpr wrote:
... I am attempting to do some reporting from a JIRA database. What is a JIRA database?
I am attaching code and a sample list of the results. If I am not quite clear, please ask for information and I will attempt to provide more. Whenever you have a question, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and the results you want from that data.
Simplify the problem as much as possible. For example, if the part you don't know how to do only involves 2 tables, then jsut post a question involving those 2 tables. So you might just post this much data:
CREATE TABLE changegroup
( issueid NUMBER
, created DATE
, id NUMBER
INSERT INTO changegroup (issueid, created, id) VALUES (21191, TO_DATE ('2008-07-16 09:30:38 AM', 'YYYY-MM-DD HH:MI:SS AM'), 10);
INSERT INTO changegroup (issueid, created, id) VALUES (21191, TO_DATE ('2008-07-16 11:37:02 AM', 'YYYY-MM-DD HH:MI:SS AM'), 20);
INSERT INTO changegroup (issueid, created, id) VALUES (21191, TO_DATE ('2010-06-08 09:14:52 AM', 'YYYY-MM-DD HH:MI:SS AM'), 90);
INSERT INTO changegroup (issueid, created, id) VALUES (21191, TO_DATE ('2010-09-02 11:29:37 AM', 'YYYY-MM-DD HH:MI:SS AM'), 10);
INSERT INTO changegroup (issueid, created, id) VALUES (21191, TO_DATE ('2010-09-02 11:29:42 AM', 'YYYY-MM-DD HH:MI:SS AM'), 10);
INSERT INTO changegroup (issueid, created, id) VALUES (21191, TO_DATE ('2010-09-02 11:29:50 AM', 'YYYY-MM-DD HH:MI:SS AM'), 20);
INSERT INTO changegroup (issueid, created, id) VALUES (21191, TO_DATE ('2010-09-02 11:29:53 AM', 'YYYY-MM-DD HH:MI:SS AM'), 90);
INSERT INTO changegroup (issueid, created, id) VALUES (23234, TO_DATE ('2008-10-03 10:26:21 AM', 'YYYY-MM-DD HH:MI:SS AM'), 10);
INSERT INTO changegroup (issueid, created, id) VALUES (23234, TO_DATE ('2008-11-17 09:39:39 AM', 'YYYY-MM-DD HH:MI:SS AM'), 20);
INSERT INTO changegroup (issueid, created, id) VALUES (23234, TO_DATE ('2011-02-02 06:18:02 AM', 'YYYY-MM-DD HH:MI:SS AM'), 90);
INSERT INTO changegroup (issueid, created, id) VALUES (23977, TO_DATE ('2008-09-29 02:44:54 PM', 'YYYY-MM-DD HH:MI:SS AM'), 10);
INSERT INTO changegroup (issueid, created, id) VALUES (23977, TO_DATE ('2010-05-29 04:47:37 PM', 'YYYY-MM-DD HH:MI:SS AM'), 30);
INSERT INTO changegroup (issueid, created, id) VALUES (23977, TO_DATE ('2011-02-02 06:14:57 AM', 'YYYY-MM-DD HH:MI:SS AM'), 10);
INSERT INTO changegroup (issueid, created, id) VALUES (23977, TO_DATE ('2011-02-02 06:15:32 AM', 'YYYY-MM-DD HH:MI:SS AM'), 20);
INSERT INTO changegroup (issueid, created, id) VALUES (23977, TO_DATE ('2011-02-02 06:15:47 AM', 'YYYY-MM-DD HH:MI:SS AM'), 90);
CREATE TABLE changeitem
( groupid NUMBER
, newstring VARCHAR2 (10)
INSERT INTO changeitem (groupid, newstring) VALUES (10, 'Open');
INSERT INTO changeitem (groupid, newstring) VALUES (20, 'Testing');
INSERT INTO changeitem (groupid, newstring) VALUES (30, 'Blocked');
INSERT INTO changeitem (groupid, newstring) VALUES (90, 'Closed');Then post the results you want to get from that data, like this:
ISSUEID HISTORY
21191 Open (0) >> Testing (692) >> Closed
23234 Open (45) >> Testing (807) >> Closed
23977 Open (607) >> Blocked (249) >> Open (0) >> Testing (0) >> ClosedExplain how you get those results from that data. For example:
"The output contains one row per issueid. The HISTORY coloumn shows the different states that the issue went through, in order by created, starting with the earliest one and continuing up until the first 'Closed' state, if there is one. Take the first row, issueid=21191, for example. It started as 'Open' on July 16, 2008, then, on the same day (that is, 0 days later) changed to 'Testing', and then, on June 8, 2010, (692 days later), it became 'Closed'. That same issue opened again later, on September 2, 2010, but I don't want to see any activity after the first 'Closed'."
The database is 10.2.0.4That's very important. Always post your version, like you did.
Here's one way to get those results from that data:
WITH got_order_row AS
SELECT cg.issueid
, LEAD (cg.created) OVER ( PARTITION BY cg.issueid
ORDER BY cg.created
- cg.created AS days_in_stage
, ROW_NUMBER () OVER ( PARTITION BY cg.issueid
ORDER BY cg.created
) AS order_row
, ci.newstring AS change_type
FROM changegroup cg
JOIN changeitem ci ON cg.id = ci.groupid
WHERE ci.newstring IN ( 'Blocked'
, 'Closed'
, 'Testing'
, 'Open'
-- AND ... -- any other filtering goes here
SELECT issueid
, SUBSTR ( SYS_CONNECT_BY_PATH ( change_type || CASE
WHEN CONNECT_BY_ISLEAF = 0
THEN ' ('
|| ROUND (days_in_stage)
|| ')'
END
, ' >> '
, 5
) AS history
FROM got_order_row
WHERE CONNECT_BY_ISLEAF = 1
START WITH order_row = 1
CONNECT BY order_row = PRIOR order_row + 1
AND issueid = PRIOR issueid
AND PRIOR change_type != 'Closed'
ORDER BY issueid
;Combining data from several rows into one big delimited VARCHAR2 column on one row is call String Aggregation .
I hope this answers your question, but I guessed at so many things, I won't be surprised if it doesn't. If that's the case, point out where this is wrong, post what the results should be in those places, and explain how you get those results. Post new data, if necessary. -
Concatenation Multiple Rows into Single Row
My select query is like wise
ID Name
1 Arthi
2 Preethi
3 Madhu
4 Saranya
Above i listed all the names using the select query. Now i have to combine this 4 rows in single row like
Arthi,Preethi,Madhu,Saranya.
Also this rows may be 5 or 50 too. So what are Names listed using select statement those should combine into one Single String.
Help me plPlease post this in an appropriate forum;
SQL and PL/SQL
PL/SQL
Community Feedback and Suggestions (Do Not Post Product-Related Questions Here)
Adith -
Hi friends,
I have one table like:
10 SAM
10 CAN
10 MAN
10 DEV
20 MAL
And want output like:
10 SAM,CAN,MAN,DEV
20 MAL
i want to combine multiple rows into one within an existing view.
What query will suit this to get this type of output.Please refer to this thread
column values separated by , -
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
Problem in displaying the data of columns into rows in sap script
hi,
i am working on a sap script and i have to display the dat which is displayed in column into rows but it is not displaying it properly.
eg, C
12.1
Si
5.5
it is displaying the data right now like this but i want to display the data like this:-
eg, C Si
12.1 5.5
plzzprovide me guidelines how to solve this problem.hi,
i am using this code to display the data:-
plzz provide me guidelines where i am getting wrong?
TOPparCOMPONENT DESP,,,,,, INS. LOT #, , , , , , MIC,,,,,,,,,, MIC VALUEparENDTOPparFINAL
PROTECT
IF &I_FINAL-PRUEFLOS& NE '000000000000'
&I_FINAL-MAKTX(23)&&i_final-prueflos(12Z)&
&I_FINAL-kurztext(25)&
&I_FINAL-original_input(8)&
ELSE
&I_FINAL-MAKTX(23)&
&I_FINAL-kurztext(25)&
&I_FINAL-original_input(8)&
ENDIF
ENDPROTECT
ITEMHEAD
POSITION WINDOW
SIZE WIDTH +0 . 4 CH HEIGHT +1 LN
BOX FRAME 10 TW
BOX HEIGHT '1.35' LN INTENSITY 20
IF &PAGE& = '1'
BOX XPOS '0' CH YPOS '0' CM WIDTH '0' CM HEIGHT '43' LN FRAME '10' TW
For horizontal line at top
BOX XPOS '0' CH YPOS '0' CM WIDTH '75' CH HEIGHT '0' LN FRAME '10' TW
COLUMN LINES...
END OF COLUMN LINES...
BOX XPOS '0' CH YPOS '43' LN WIDTH '75' CH HEIGHT '0' LN FRAME '10'TW
BOX XPOS '75' CH YPOS '0' LN WIDTH '0' CH HEIGHT '43' LN FRAME '10'TW
ELSE
COLUMN LINES...
END OF COLUMN LINES...
BOX XPOS '0' CH YPOS '0' CM WIDTH '0' CM HEIGHT '47' LN FRAME '10' TW
BOX XPOS '0' CH YPOS '0' CM WIDTH '75' CH HEIGHT '0' LN FRAME '10' TW
BOX XPOS '0' CH YPOS '0' CM WIDTH '45' CM HEIGHT '0' LN FRAME '10' TW
BOX XPOS '20' CH YPOS '0' CM WIDTH '0' CM HEIGHT '47' LN FRAME '10' TW
BOX XPOS '0' CH YPOS '47' LN WIDTH '75' CH HEIGHT '0' LN FRAME '10'TW
BOX XPOS '75' CH YPOS '0' LN WIDTH '0' CH HEIGHT '47' LN FRAME '10'TW
ENDIF
LINEFEED
NEWPAGE
NEW-PAGE
provide me guidelines to solve this problem.
Edited by: ricx .s on Mar 13, 2009 5:58 AM -
Error inserting a row into a table with identity column using cfgrid on change
I got an error on trying to insert a row into a table with identity column using cfgrid on change see below
also i would like to use cfstoreproc instead of cfquery but which argument i need to pass and how to use it usually i use stored procedure
update table (xxx,xxx,xxx)
values (uu,uuu,uu)
My component
<!--- Edit a Media Type --->
<cffunction name="cfn_MediaType_Update" access="remote">
<cfargument name="gridaction" type="string" required="yes">
<cfargument name="gridrow" type="struct" required="yes">
<cfargument name="gridchanged" type="struct" required="yes">
<!--- Local variables --->
<cfset var colname="">
<cfset var value="">
<!--- Process gridaction --->
<cfswitch expression="#ARGUMENTS.gridaction#">
<!--- Process updates --->
<cfcase value="U">
<!--- Get column name and value --->
<cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
<cfset value=ARGUMENTS.gridchanged[colname]>
<!--- Perform actual update --->
<cfquery datasource="#application.dsn#">
UPDATE SP.MediaType
SET #colname# = '#value#'
WHERE MediaTypeID = #ARGUMENTS.gridrow.MediaTypeID#
</cfquery>
</cfcase>
<!--- Process deletes --->
<cfcase value="D">
<!--- Perform actual delete --->
<cfquery datasource="#application.dsn#">
update SP.MediaType
set Deleted=1
WHERE MediaTypeID = #ARGUMENTS.gridrow.MediaTypeID#
</cfquery>
</cfcase>
<cfcase value="I">
<!--- Get column name and value --->
<cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
<cfset value=ARGUMENTS.gridchanged[colname]>
<!--- Perform actual update --->
<cfquery datasource="#application.dsn#">
insert into SP.MediaType (#colname#)
Values ('#value#')
</cfquery>
</cfcase>
</cfswitch>
</cffunction>
my table
mediatype:
mediatypeid primary key,identity
mediatypename
my code is
<cfform method="post" name="GridExampleForm">
<cfgrid format="html" name="grid_Tables2" pagesize="3" selectmode="edit" width="800px"
delete="yes"
insert="yes"
bind="cfc:sp3.testing.MediaType.cfn_MediaType_All
({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
onchange="cfc:sp3.testing.MediaType.cfn_MediaType_Update({cfgridaction},
{cfgridrow},
{cfgridchanged})">
<cfgridcolumn name="MediaTypeID" header="ID" display="no"/>
<cfgridcolumn name="MediaTypeName" header="Media Type" />
</cfgrid>
</cfform>
on insert I get the following error message ajax logging error message
http: Error invoking xxxxxxx/MediaType.cfc : Element '' is undefined in a CFML structure referenced as part of an expression.
{"gridaction":"I","gridrow":{"MEDIATYPEID":"","MEDIATYPENAME":"uuuuuu","CFGRIDROWINDEX":4} ,"gridchanged":{}}
ThanksIs this with the Travel database or another database?
If it's another database then make sure your columns
allow nulls. To check this in the Server Navigator, expand
your DataSource down to the column.
Select the column and view the Is Nullable property
in the Property Sheet
If still no luck, check out a tutorial, like Performing Inserts, ...
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/index.jsp
John -
Need to insert rows into 100 tables at a time
hi there,
below is our script for creation of 100 tables...
we need a plsql script, to insert rows into 100 tables at a single time...
please help us...vey urgent...
DECLARE
counter NUMBER;
sql_string VARCHAR2(2000);
BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_table'||counter||'
(id integer primary key, col_a VARCHAR2(42),col_b date,col_c number,col_d varchar2(20),col_e varchar2(20),
col_f varchar2(20),col_g varchar2(20),col_h date,col_i varchar2(20),col_j varchar2(20),col_k date)';
EXECUTE IMMEDIATE sql_string;
END LOOP;
END;
/hi,
below is our procedure and the error we are getting...
Name Null? Type
ID VARCHAR2(10)
COL_A VARCHAR2(10)
COL_B VARCHAR2(10)
COL_C VARCHAR2(10)
COL_D VARCHAR2(10)
COL_E VARCHAR2(10)
COL_F VARCHAR2(10)
COL_G VARCHAR2(10)
COL_H VARCHAR2(10)
COL_J DATE
DECLARE
counter NUMBER;
sql_string VARCHAR2(4000);
BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_a'||counter||'
(id varchar2(10), col_a varchar2(10), col_b varchar2(10), col_c varchar2(10), col_d varchar2(10), col_e varchar2(10),
col_f varchar2(10), col_g varchar2(10), col_h varchar2(10), col_j date)';
EXECUTE IMMEDIATE sql_string;
END LOOP;
END;
DECLARE
counter NUMBER;
sql_string VARCHAR2 (2000);
BEGIN
FOR OuterCounter IN 1 .. 100 LOOP --- table prefix in which it is to be inserted
FOR InnerCounter IN 1 .. 100 LOOP --- records to be inserted
sql_string := 'INSERT INTO emp_a' || Outercounter || ' (id, col_a, col_b, col_c, col_d, col_e, col_f, col_g, col_h, col_j)
VALUES ('
|| InnerCounter || ', to_char( ''col_a''' || innercounter || '),'
|| InnerCounter || ', to_char( ''col_d''' || innercounter || '),'
|| ', to_char( ''col_e''' || innercounter || '),'
|| ', to_char( ''col_f''' || innercounter || '),'
|| ', to_char( ''col_g''' || innercounter || '),'
|| ', to_char( ''col_h''' || innercounter || '),'
|| ', to_char( ''col_j''' || innercounter || '), SYSDATE)';
EXECUTE IMMEDIATE sql_string;
END LOOP;
END LOOP;
END;
DECLARE
ERROR at line 1:
ORA-00907: missing right parenthesis
ORA-06512: at line 17
please check the procedure and write the correct one... -
Get Multiple Rows into internal Table using Webdynpro Alv Display ..
Hi guys ,
I need to find out the logic for getting all the selected rows into the internal table.
When i display the ALV Output on webdypro screen .
USer Selects multiple rows for further processing ..
Ineed to get all the rows selected by user into an internal table .
Please let me know how to achive this ...
Thanks in advance for quick reply
Regards
Saurabh GoelHi,
You need to use the method GET_SELECTED of IF_WD_CONTEXT_NODE to get the rows selected. Also ccheck for the paramters of that method, this retruns the element set.
This meets your requirement.
Regards,
Lekha. -
Inserting rows into a data block
Hi, how do i insert 'n' rows into a data block and after that commit the changes into the data base.
Thanks for any help.You can use something like this:
Go_Block('my_block');
first_record;
LOOP
.... insert values to the items
next_record;
END LOOP;
- for commiting changes
Do_Key('Commit_Form');
I hope this will help you.
Helena -
Inserting Multiple Rows into Database Table using JDBC Adapter - Efficiency
I need to insert multiple rows into a database table using the JDBC adapter (receiver).
I understand the traditional way of repeating the statement multiple times, each having its <access> element. However, I am just wondering whether this might be performance-inefficient, as it might insert records one by one.
Is there a way to ensure that the records are inserted into the table as a block, rather than record-by-record?Hi Bhavesh/Kanwaljit,
If we have multiple ACCESS tags then what happens is that the connection to the database is made only once. But the data is inserted row by row.
Why i am saying this?
If we add the following in JDBC Adapter..logSQLStatement = true. Then incase of multiple inserts we can see that there are multiple
<i>Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','1000')
Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','2000')</i>
Doesnt this mean that rows are inserted one by one?
Correct me if i am wrong.
This does not mean that the transaction is not guaranted. Either all the rows will be inserted or rolled back.
Regards,
Sumit -
Help in inserting rows into a table
I have a table called acct_fact,
I need to insert rows in the table using a script but the problem is there's a column called seq_nbr which has random seq nbr of 14character length like 'ZWX98MGD9MVAD6J','ZWX98MG67RVAD6J' etc.,
While inserting rows I need to generate such seq_nbr for those columns and insert rows into the table, can I use any such mechanism in my insert query to insert such random nbr's while inserting rows into a table.
If so please suggest meHi Peter,
Thankyou for the quick reply:)
can you suggest me how to implement it here in my script snippet:
while read var_acct_nbr
do
echo "update acct_attr set acct_attr_exp_dt ='$ExpDate' where Acct_Attr_Value_Text='15' and acct_attr_exp_dt is null and person_id='LDCarrBillAgrm' and acct_nbr='$var_acct_nbr' ;" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
echo "insert into acct_fact values ('$var_acct_nbr','$ExpDate','$ExpTime','*seq_nbr*','N','ProjTereza','Remoção de acordo d; data de expiração: $ExpDate',null,'1','LDE',null);" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
done < ./$DirectoryName/ExpireAccts_$TimeStamp.LOG
the script takes each acct_nbr nbr form a input file and fires an insert statement.
The one in bold is the column where such sequence need to be inserted.can you help me in implementing the way you suggested in my script i.e., insert statement
Thanks in Advance:)
Edited by: rkrish on Jun 27, 2012 3:04 AM
Maybe you are looking for
-
I need a download link for acrobat 9 pro.
I have the disk for Adobe acrobat 9 pro and I have gotten a new computer. I have tried putting the disk in to upload it but it is not working. If someone can help me find a link to download the trial version of it that would be great. then I can just
-
Can't upgrade Solaris Express 11 to Solaris 11 because pkg is broken
IPS won't let me know proceed with updating unless I update the pkg command. After I do so, it no longer works at all File "/usr/bin/pkg", line 5954, in handle_errors __ret = func(*args, **kwargs) File "/usr/bin/pkg", line 5918, in main_func runid=ru
-
Hi, I have different data sources/devices that will send thousands of events to the eventhubs that are then processed by stream analytics. Is it a good practice to have one event hub for each data source/device? Thanks a lot and best regards, Pablo
-
Script to collect cpu,io & memory usage linux
Hi is there a basic script that collects cpu,memory,i/o network stats for linux on hourly basis? i need it to be in a format that I can easily import into ms excel and display as graph, I dnt want any 3rd party software because I rather not to instal
-
Do you need a new ISBN when you're releasing a same book in different language? Also, does categories will be translated when I setup the those in iTunes producer? If not, how can I setup the categories? Thanks in advance!