Merging corresponding coloumns of multiple rows to get a single row
hi,
plz help me in sorting out this problem.this is my query.
select distinct h.ccid,
DECODE(a.prmcd,'ELEREP', sum(d.period_net_dr - d.period_net_cr)) A,
DECODE(a.prmcd,'GENREP', sum(d.period_net_dr - d.period_net_cr)) B
DECODE(a.prmcd,'BLDGREP', sum(d.period_net_dr - d.period_net_cr)) C,
DECODE(a.prmcd,'MCREP', sum(d.period_net_dr - d.period_net_cr)) D,
DECODE(a.prmcd,'SPARES', sum(d.period_net_dr - d.period_net_cr)) E
from fics_prmtrval a,
figl_code_combinations_mview_1 c,
figl_balances_mview_1 d,
fims_comstr e,
FIMS_PCSCMSTR f,
FIMS_CCMSTR g,
FIMS_CODECOMBINATIONS h
where a.prmcd in('ELEREP', 'GENREP', 'MCREP', 'BLDGREP', 'SPARES')
and a.prmval = c.segment4
and c.code_combination_id = d.code_combination_id
and e.cocd = c.segment1
and f.PCSCCD = C.SeGMENT2
and g.CCCD = C.SEGMENT3
and h.COID = e.coid
and h.PCID = f.PCSCID
and h.CCID = g.CCID
and h.stid = 1
and h.coid = 1
and h.pcid = 1
group by h.ccid,
g.ccnm,
a.prmcd
the output of this is :
CCID A B C D E
16 1
16 2
17 3
17 4
17 5
17 6
but i need the out put in the following format:
CCID A B C D E
16 1 2
17 3 4 5 6
plz suggest me a possible solution for this
Hi,
Enclose all your decodes by MAX like this MAX( DECODE(...)) and group your result by ccid column only and remove the distinct key word( it is not needed since you will be already grouping on ccid so distinct would be kind of redundant ).
For any furthur clarifications refer this link, it is easy to follow.
http://asktom.oracle.com/pls/ask/f?p=4950:8:8495196364001188355::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:124812348063
Thanks,
Khalid
Similar Messages
-
Merging multiple rows in to a single row (when rows meet merging criteria)
Hi
I have a scenario to merge multiple rows in to a single rows when the data in those rows fall in merge criteria .Below is how my data is
Now the merging logic for the above rows is , we need to combine multiple rows in to a single row when the data in those rows permits us to do in that way. Simply saying , its like sandwich where we combine multiple things to a single piece.The output for
the above rows should be
Here we combined Row 1 ,2, 3 in to a single row as the data in those rows permits to merge in to single row. But the row 4 cannot be combined to any of those rows because the data in those rows doesn't permits us do a merge ( As the value of the column
JobSource for the row 4 is different from the other rows ) .
My original data has 56 columns , but for readability i kept only 9 columns.
can you please throw some idea on how to achieve this scenario. I know we need to use CTE for achieving this, but i am not able succeed in doing an iteration on multiple rows.
Appreciate your response .Thanks for your reply .
Rule for merging is simple . First of all there is no unique row identifier for each row , the fact table is not having an identity column in the database . I called row 1 , row 2 etc in my post above only to make better explanation of my scenario.
The rule for merge is below.
1) we can combine only when the data in a column for one row is null & the data in same column for the other row is not null . It should also satisfy the condition where the data in other columns should conflict each other.
2) Data for all columns for the merging rows should not be conflicting (i.e. we should not merge the rows when the data in a column is not equal to the same column in the other row
,considering not null value)
Steps in merging the above source data :
1) Consider the case of row 1 and row 2 in the source, we can combine these rows as the data is satisfying the rule 1 for columns (Jobsource,Flight, Package,Update,Iscancelled
,Result, Severity) and columns (JobID and RuleName ) fall under rule 2. we merge these two rows in to a single row and keep in that in the table.
2) Then the resulting row is again merged with the second row which is present above by applying the rule 1 and rule 2 . Below would be output of merge operation.
Now there would be only two rows in the output . But these rows cannot be merged as the data doesn't satisfy the merge rules 2 . As Jobsource for the row 1 in the above output is "PresubmissionSource" which is not equal
to "PostSubmission" jobSource which is in row 2. So these two rows are left unmerged .So the above two rows would be the output of merge operation on my source data.
This process has to be repeated for all the rows in the table. As of now my table as 92 Million rows with 56 columns which need to be considered for merging rows. I replicated my scenario in 9 columns and 4 rows to understand better. -
How to get a single row column from a viewobject in java?
I have a class file that goes out and gets a viewobject and sets its where clause
this is it:
vcRow = vc.createViewCriteriaRow();
vcRow.setAttribute("LogonId", "='" + strPcis_Login.toUpperCase() + "'");
vc.addElement(vcRow);
vo.applyViewCriteria(vc);
vo.executeQuery();
I know this working cause I can watch it in debug..
but now the problem.
I've looked in the docs and don't see how one can pull the value of the row it found and place it in a uix page in a textinput area
how can I get a single row column, in this case the UserName that is in the view object to a string and then place it into my
uix page? I've looked and looked and don't see a method for this.
is there a way to take the oracle.cabo.servlet.Page and set a textinput with a viewobject get method?
what way do you do this and where is it documented?is there a way to take the oracle.cabo.servlet.Page and set a textinput with a viewobject get method?
what way do you do this and where is it documented? What you can do is get the value from your VO and set it somewhere that UIX can data bind to -- as a Page proprety, on HttpSession, etc. This is documented in Chapters 4 (Data Binding) and 5 (Controller) of the UIX Developer's Guide.
To set a property, you use Page.setProperty(String key, String value). Then, in your UIX file, to make a textInput that has the value pulled from a given page property, use:
<textInput data:text="key@ctrl:page" />
-brian
Team UIX -
Adobe form from webdynpro : Getting a single row in the table
Hello,
I have a scenario in which I have to create a adobeform from webdynpro application.
I have created the form and have the context designed in place.
I am facing a problem in the table I have in my adobeform.
I am adding rows to this table dynamically using a button using "addInstance"
Now on the webdynpro side , when I try to read this table I get a single row from this table.
This row is always the first row of that table.
I checked the following things from blog /people/juergen.hauser2/blog/2006/09/12/avoiding-common-mistakes-when-using-tables-on-sap-interactive-forms , i.e. :
Cardinality of the node.
Tick on the option "Repeat Row for Each Data Item".
But still no success.
With deadlines to catch I had to post this question after trying a lot.Please help.Hello Otto,
I had found this link before and used the same solution , but unfortunately is taking a long time.
Now what I am doing is :
1. I append 10 rows into the table then bind it to the node
2. Then on the adobe form I have removed the check on "Add row for each line item" because of which it shows only 1 row
on the form.
Now I add rows dynamically, but this puts a limit on the number of rows can be added to the table i.e. 10.
But this again has added problems like while displaying the form or modifying I hav to handle it seperately and cannot use the same form as it is.( as I have removed the tick for "Add row for each line item" ).
Thanks,
Omkar Mirvankar -
PL/SQL muliple row insert for a single row
I need to insert multiple rows based on a single row record. Below are the table structures and sample data
CREATE TABLE TEST_SAMPLE (NAME VARCHAR2(20), ATTR_1 VARCHAR2(20), ATTR_2 VARCHAR2(20), ATTR_3 VARCHAR2(20),ATTR_4 VARCHAR2(20));
CREATE TABLE TRANSACTION (NAME VARCHAR2(20), ATTR VARCHAR2(20))
insert into TEST_SAMPLE (NAME, ATTR_1, ATTR_2, ATTR_3,ATTR_4) values ('hello','asd','fgh','ert',null);For the above record in table TEST_SAMPLE, three records have to be populated\inserted into table TRANSACTION. In PL/SQL
stored procedure i am inserting records to TRANSACTION when ATTR_1 or ATTR_2 or ATTR_3 or ATTR_4 is not null.
Please help me to find a better way for the above insert to table TRANSACTION?Thanks for helping me here. For the sample record in table TEST_SAMPLE i mentioned above three records need to be inserted in table TRANSACTION. you have this, or?
CREATE TABLE TEST_SAMPLE (NAME VARCHAR2(20), ATTR_1 VARCHAR2(20), ATTR_2 VARCHAR2(20), ATTR_3 VARCHAR2(20),ATTR_4 VARCHAR2(20));
CREATE TABLE TEST_TRANSACTION (NAME VARCHAR2(20), ATTR VARCHAR2(20));
insert into TEST_SAMPLE (NAME, ATTR_1, ATTR_2, ATTR_3,ATTR_4) values ('record 1','asd','fgh','ert',null);
insert into TEST_SAMPLE (NAME, ATTR_1, ATTR_2, ATTR_3,ATTR_4) values ('record 2',null,'fgh','ert',null);
insert into TEST_SAMPLE (NAME, ATTR_1, ATTR_2, ATTR_3,ATTR_4) values ('record 3','asd',null,'ert',null);
insert into TEST_SAMPLE (NAME, ATTR_1, ATTR_2, ATTR_3,ATTR_4) values ('record 4','asd','fgh',null,null);
insert into TEST_SAMPLE (NAME, ATTR_1, ATTR_2, ATTR_3,ATTR_4) values ('record 5','asd',null,null,null);
insert into TEST_SAMPLE (NAME, ATTR_1, ATTR_2, ATTR_3,ATTR_4) values ('record 6',null,null,null,null);
commit;
insert into TEST_TRANSACTION
select NAME,
ATTR_1
from TEST_SAMPLE
where ATTR_1 is not null
union all
select NAME,
ATTR_2
from TEST_SAMPLE
where ATTR_2 is not null
union all
select NAME,
ATTR_3
from TEST_SAMPLE
where ATTR_3 is not null
union all
select NAME,
ATTR_4
from TEST_SAMPLE
where ATTR_4 is not null
commit;
select *
from TEST_TRANSACTION
order by 1;
Table created.
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
Commit complete.
10 rows created.
Commit complete.
NAME ATTR
record 1 asd
record 1 fgh
record 1 ert
record 2 fgh
record 2 ert
record 3 ert
record 3 asd
record 4 fgh
record 4 asd
record 5 asd
10 rows selected. -
Merge two rows & show in a single row in table results
Hi, I need to merge 2 rows having 3 columns in a single row in table view
The cols are currently shown as :
Project NO-------(Current_Month) Revenue----------(Prior_Month) Revenue
123123 10000
20000
Revenue is a single column with revenue for diffreent Period.
10000 is for May
20000 is for April
Project NO for both are same, just the periods are different. if I am not displaying Period i need to merge the 2 rows & show as
Project NO-------(Current_Month) Revenue----------(Prior_Month) Revenue
123123 10000 20000
Please let me know how we can acheive this??
thanx
Pankaj123123 is the project number..
the above is not getting displayed properly....as the blank spaces are removed...
Please consider this -
Multiple pages that edit a single row
I have searched on tabs and editing a single row using multiple pages and I am confused. I don't want to use java as I am trying to not learn that too...
What I am trying to do sounds like it has been explained before but let me do this again...
I have a record that is too large to fit on a single screen. This makes for a cumbersome entry process. The record is actually broken into four "logical" chunks. Main, Sub1, Sub2 and Sub3.
I have made a list that will allow the record to be selected and call the first logical page... L1.
I have made tabs that show all the pages and allow me to navigate between them quickly.
When I get to L1 all the data is there. I may not change any data on that page and go directly to L2 through L4. However the record is not brought forward onto those pages. So the pages are not related (and I don't have the terminology right I know :) and I could "link" the pages. So here is what I would like the application to do;
1. Display a list and allow the user to select the record to edit.
2. Upon edit go to the first page (tab).. this works
3. Allow the user to select a tab and the page displays the data for the record selected
4. Allow the user to complete the edits and save the record. Upon save the user is returned to the list in step 1.
I was thinking there are several ways to do it... but I was hoping someone could save me a bunch of trial and error (emphasis on the error) ...
1. When navigating off the page save the record, pass the key and re-read the record... ugly huh?
2. Pass all the session data for the record over to the next screen. Is that possible? e.g pxx_field1 = pyy_field1
The the question was does a template with two level tabs keep the record data between tabs?
Any help is greatly appreciated.
SamI think this works... kinda
1. I have a "list" that allows the selection of the item to edit.
2. That list opens a page that is the "header" page for a tab set.
3. Each page in the tab set uses the same "ID" to read the record and display the columns. That is how it would work if the list called each individual page.
4. I modified the "slave" tabs to have the "ID" of the "header" page.
This displays the correct data on each page. And it looks like the "apply changes" button saves the changes on the page.
Caveats inlclude (I think as I haven't done exhaustive testing"
1. "apply changes" must be done at each page where there were changes or they would be lost.
2. The first dispaly of the page is blank. Clicking on the tab a second time displays the data. This is true if it is the first time a user selects a record in a session (the "slave" tabs are blank) or if it is a subsequent record update (the "slave" tabs have the last records data.
Thoughts... is this really boring to everyone but me?
Sam -
Getting Error - Single-row subquery returns more than 1 row (Help Needed)
I have the following SQL. It selects several rows of data. This data reflects changed records. I want to update PS_UNI_TEXTBK_SKEW for the values selected. Any ideas. For updating I used:
update ps_uni_textbk_skew s
set (s.ssr_txbdtl_title, s.ssr_txbdtl_isbn, s.ubs_skew_num, s.process_date, s.ubs_rec_type) = (
and then I included theselect listed below. (this selects does work). It always produces an error saying 'singl-row subjquery returns more than 1 row'.
Any help would be appreciated. I've worked on this for a week now trying many different ways. Thanks, Mary
SELECT NOW.SSR_TXBDTL_TITLE
,NOW.SSR_TXBDTL_ISBN
,0
,SUBSTR(SYSDATE,1,8)
,'C'
FROM
SELECT C.SUBJECT||C.CATALOG_NBR||C.CLASS_SECTION||C.STRM||B.SSR_TXBDTL_SEQNO AS TYINGKEEN
,C.CRSE_ID
,C.CRSE_OFFER_NBR
,C.STRM
,C.SUBJECT
,C.CATALOG_NBR
,C.CLASS_SECTION
,C.DESCR
,B.SSR_TXBDTL_SEQNO
,B.SSR_CRSEMAT_TYPE
,B.SSR_TXBDTL_STATUS
,B.SSR_TXBDTL_TITLE
,B.SSR_TXBDTL_ISBN
,B.SSR_TXBDTL_AUTHOR
,B.SSR_TXBDTL_PUBLISH
,B.SSR_TXBDTL_EDITION
,B.SSR_TXBDTL_PUBYEAR
,B.SSR_TXBDTL_NOTES
FROM PS_CLASS_TBL C,
PS_SSR_CLS_TXB_DTL B
WHERE C.CRSE_ID = B.CRSE_ID
AND C.CRSE_OFFER_NBR = B.CRSE_OFFER_NBR
AND C.STRM = B.STRM
AND C.CLASS_SECTION = B.CLASS_SECTION
) NOW,
SELECT SUBJECT||CATALOG_NBR||CLASS_SECTION||STRM||SSR_TXBDTL_SEQNO AS TYINGKEEL
,CRSE_ID
,CRSE_OFFER_NBR
,STRM
,SUBJECT
,CATALOG_NBR
,CLASS_SECTION
,DESCR
,SSR_TXBDTL_SEQNO
,SSR_CRSEMAT_TYPE
,SSR_TXBDTL_STATUS
,SSR_TXBDTL_TITLE
,SSR_TXBDTL_ISBN
,SSR_TXBDTL_AUTHOR
,SSR_TXBDTL_PUBLISH
,SSR_TXBDTL_EDITION
,SSR_TXBDTL_PUBYEAR
,SSR_TXBDTL_NOTES
FROM PS_UNI_TEXTBK_SKEW
) LAST
WHERE NOW.TYINGKEEN = LAST.TYINGKEEL
AND (NOW.SSR_TXBDTL_TITLE <> LAST.SSR_TXBDTL_TITLE
OR NOW.SSR_TXBDTL_ISBN <> LAST.SSR_TXBDTL_ISBN
OR NOW.SSR_TXBDTL_AUTHOR <> LAST.SSR_TXBDTL_AUTHOR
OR NOW.SSR_TXBDTL_PUBLISH <> LAST.SSR_TXBDTL_PUBLISH
OR NOW.SSR_TXBDTL_EDITION <> LAST.SSR_TXBDTL_EDITION
OR NOW.SSR_TXBDTL_PUBYEAR <> LAST.SSR_TXBDTL_PUBYEAR
OR NOW.SSR_TXBDTL_NOTES <> LAST.SSR_TXBDTL_NOTES
OR NOW.SSR_TXBDTL_STATUS <> LAST.SSR_TXBDTL_STATUS
OR NOW.SSR_CRSEMAT_TYPE <> LAST.SSR_CRSEMAT_TYPE
OR NOW.DESCR <> LAST.DESCR);1. Take your subqueries
2. Run those separately to see if they really can return more than one row. If needed modify the subquery by adding GROUP-BY and HAVING-COUNT>1 clauses to determien that.
3. If you see more than one row coming up from subqueries then the error message you named will arise.
This is what i would do.
But in first look you don't have subqueries, you have "inline-views". so i don't understand how the eroor could occur.
Edited by: CharlesRoos on 22.10.2010 16:38 -
Hi All
I have facing the Single row sub query Error . I tried to resolve , but my condition not working .can please any help to rewrite the query (sub query)
SELECT DISTINCT wdlsv.serial_number
,wdlsv.date_shipped
,wdlsv.inventory_item_id
,wdlsv.organization_id
,wdlsv.lot_number
,(select distinct engine from xxtc_tr_pr_open_data where chassis=wdlsv.serial_number and rownum=1
union
select distinct replace(replace(attribute11,'*',''),' ','')
from xxtc_chassis_scanout_details
where serial_number=wdlsv.serial_number
and operation_line_code ='CHASSIS') "ENGINE_NO"
,oola.attribute1 oh_excise_no
,msi.attribute16 vehicle_type
,bbom.attribute2 model_no
,xxst.tariff_code tariff_code
,substr(xxst.color_type,1,1) color_type
,(SELECT TO_CHAR(trunc(rt.transaction_date),'RRRRMMDD')
FROM rcv_transactions rt,
rcv_shipment_lines rsl,
rcv_shipment_headers rsh
WHERE rsh.shipment_header_id=rsl.shipment_header_id
AND rt.shipment_header_id=rsl.shipment_header_id
AND rsl.attribute1=wdlsv.lot_number
AND rt.organization_id=wdlsv.organization_id
AND rt.organization_id=rsh.organization_id
AND ROWNUM<=1
union
select distinct to_char(xxtp.indent_import_date,'RRRRMMDD')
from xxtc_tr_pr_open_data xxtp
where xxtp.chassis = wdlsv.serial_number) "CKD_IMPORT_DATE_YEAR"
,to_char(xxtp.indent_import_date,'RRRRMMDD') import_date
FROM WSH_DELIVERY_LINE_STATUS_V WDLSV
,oe_order_headers_all ooha
,oe_order_lines_all oola
,mtl_system_items_b msi
,bom_bill_of_materials bbom
,xxtc_sales_tax_cal xxst
WHERE 1=1
AND PICK_STATUS = 'C'
AND delivery_status = 'CL'
AND ooha.header_id = wdlsv.source_header_id
AND ooha.header_id = oola.header_id
AND oola.line_id = wdlsv.source_line_id
AND msi.inventory_item_id = wdlsv.inventory_item_id
AND msi.organization_id = wdlsv.organization_id
AND bbom.assembly_item_id = wdlsv.inventory_item_id
AND bbom.organization_id = wdlsv.organization_id
AND xxst.inventory_item_id = wdlsv.inventory_item_id
AND xxst.organization_id = wdlsv.organization_id
and upper(msi.attribute15) not like 'SUB%'
AND WDLSV.SERIAL_NUMBER IS NOT NULL;
Regards
SanjayThis forum is for questions about working with SQL*Developer. The title is "SQL Developer (Not for general SQL/PLSQL questions)" and yours is a general SQL question. You should get a better answer by re-posting in the SQL and PL/SQL forum in the Oracle Database section. Please mark this tread as answered and re-post there.
-
To make Three row values in a single row
Hi,
Below is the Table Format i have.
Here for the first Mail_ID i have 3 mail addresses.similarly for second ID too.
I want First three rows to be in a single row.and so on...
Plz help in doing this.
Thanks
DeepaDeepa,
Check if this helps.. Does dynamic conersion of data to columns ..
--Your Email table
create table #temp (mailid int,to_mail varchar(100))
insert #temp select 1,'[email protected]'
insert #temp select 1,'[email protected]'
insert #temp select 1,'[email protected]'
insert #temp select 2,'[email protected]'
insert #temp select 2,'[email protected]'
insert #temp select 3,'[email protected]'
--Constructing a temp table to hold data with row_numbers
select *,row_number() over(partition by mailid order by to_mail) as rn
into #t
from #temp
--declaration of variables
declare @n int,@list varchar(max),@sql nvarchar(max)
set @n=(select max(rn) from #t)
--Population of list to form the dynamic query
;with cte
as
select cast(',[email1]' as varchar(max)) as ch,1 as num
UNION ALL
select cast(ch+',[email'+cast((num+1) as varchar(100))+']' as varchar(max)) as ch,num+1 as num
from cte where num<@n
select top 1 @list=stuff(ch,1,1,'')
from cte
order by num desc
--Formulating the complete dynamic query
set @sql='
select mailid,'+@list+'
from
select mailid,to_mail,''email''+cast(rn as varchar) as emailnum from #t
) tab
PIVOT
max(to_mail) for emailnum in ('+@list+')
) pvt'
exec sp_executesql @sql
--clean up
drop table #t
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'> -
Merge Multiple Rows in to a single Row.
Hi
Tab_A
Col_1
Col_2
Col_3
I want resultant rows to merge on base of Col_1 (i.e. single - delimited merge row for distinct value of Col_1)
Example
Table_A
Col_1 | Col_2 | Col_3
A | 1 | 23
A | 2 | 25
B | 3 | 5
B | 6 | 9
C | 7 | 8
Required Result
Col_1 | Col_2 | Col_3
A | 1-2 | 23-25
B | 3-6 | 5-9
C | 7 | 8
Wishes
JawadYou can try with sys_connect_by_path, but I've found Re: Aggregate function to bring values in list form more performant.
You can write your query like this:
SELECT col_1
, concat_all(concat_expr(col_2,'-')) col_2
, concat_all(concat_expr(col_3,'-')) col_3
FROM yourtableMHE -
SQL Multiple Columns Displayed in a Single Row
Hello everyone,
I have 2 tables, Product and Product_Name, one Product can have more than one name.
I need to retrieve it in such a way that I show the Product_ID followed by all the names this product has.
I'm not able to make it, every way I try I get the Product ID duplicated and several rows with a different product name on each row as follows:
1, 'Iron Z"
1, 'Iron M'
1, 'Iron N'
2, 'Wood P'
2, 'Wood M'
What I need is:
1, Iron Z, Iron M, Iron N
2, Wood P, Wood M
Thanks and Regards.Hi,
user10103934 wrote:
Thank you for the answer Frank,
Iron Z, Iron M and Iron N would be 3 different entries on the same column.
I'm sure the LISTAGG function would resolve this, the problem is that I was hoping to get a solution on pure SQL or PL/SQL, maybe with a nested Select.
My Oracle version is 10g Express Edition.LISTAGG is pure SQL, but it was only introduced in Oracle 11.2. Everything mentioned below should work in Oracle 10.
The STRAGG function from that page is very useful. You have to copy and install about 60 line of PL/SQL code. Do that once, and then you can use it hundreds of times in hundreds of queries, just as if it was a built-in function. The main problem with STRAGG is that it's hard to get soprted output from it. There's a modified version, designed for sorted output, on this thread:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:15637744429336
Never used it. Can't vouch for it.
SYS_CONNECT_BY_PATH seems to be the most popular way of doing string aggregation in Oracle 10. The example given on the Oracle Base page (which I posted in my last message) is a little clumsy and inefficient. See the following thread for a better example, using CONNECT_BY_ISLEAF:
Re: Concatenate strings from more rows into one row.
or, now that I see it, Pollywog's example above.
Edited by: Frank Kulash on Jun 11, 2010 2:24 PM -
How to get a single row fetched in a form?
Hi,
I would like to make a profile page , where the (currently logged in) user can change his adress, e-mailadress etc.
This page must have only a form with input fields, filled with data from the database that the user can change. A report is not necessary because the user may only see his own data.
I tried already several things, but i get allways a form with no data from the database, with the possibility to create records (sometimes, depending on what i choosed in the wizard, also an update button).
I also changed in the 'Automated Row Fetch' the property WHERE CLAUSE with :P9_ID = 1 and even with ID = 1, but both clauses doesn't make a difference.
(1 is the value of the ID-column in my table) // (:P9_ID is a field on my page, linked to the ID-column in my table) // (ID is the PK and columnname in my table)
Is this possible to make an input form containing existing data (that a user can change), and how?
Thx.Hi,
Whats the table column which stores user login ID? lets say its APEX_LOGIN_ID then create a page item P1_APEX_LOGIN_ID and put default value to :APP_USER. Now in the ARF process, for "Item containing primary key value" put P1_APEX_LOGIN_ID and "Primary Key Column" to APEX_LOGIN_ID.
Cheers,
Hari -
How to convert multiple string values in a single row from nvarchar to int
suppose I have a table like below.all these values are in nvarchar. How would I find the minimum year from START_DATE??
PRODUCT_CODE
PRODUCT_DESC
START_DATE
P00002933
VITAMINE C
2005,2000,2011,2001,2002
P00003087
BIOFENAC
2011,2009,2006,2007,2004,2005
P00000155
AMOXYPEN
2006,2007,2008,2009,0000,2001
P00002325
SAHHA FARINE
2008,2003,2002,2001,2009
P00005666
AMOXYPEN
2007,2008,2006,2009,0000,2001Create the split function:
CREATE FUNCTION Split (
@InputString VARCHAR(8000),
@Delimiter VARCHAR(50)
RETURNS @Items TABLE (
Item VARCHAR(8000)
AS
BEGIN
IF @Delimiter = ' '
BEGIN
SET @Delimiter = ','
SET @InputString = REPLACE(@InputString, ' ', @Delimiter)
END
IF (@Delimiter IS NULL OR @Delimiter = '')
SET @Delimiter = ','
--INSERT INTO @Items VALUES (@Delimiter) -- Diagnostic
--INSERT INTO @Items VALUES (@InputString) -- Diagnostic
DECLARE @Item VARCHAR(8000)
DECLARE @ItemList VARCHAR(8000)
DECLARE @DelimIndex INT
SET @ItemList = @InputString
SET @DelimIndex = CHARINDEX(@Delimiter, @ItemList, 0)
WHILE (@DelimIndex != 0)
BEGIN
SET @Item = SUBSTRING(@ItemList, 0, @DelimIndex)
INSERT INTO @Items VALUES (@Item)
-- Set @ItemList = @ItemList minus one less item
SET @ItemList = SUBSTRING(@ItemList, @DelimIndex+1, LEN(@ItemList)-@DelimIndex)
SET @DelimIndex = CHARINDEX(@Delimiter, @ItemList, 0)
END -- End WHILE
IF @Item IS NOT NULL -- At least one delimiter was encountered in @InputString
BEGIN
SET @Item = @ItemList
INSERT INTO @Items VALUES (@Item)
END
-- No delimiters were encountered in @InputString, so just return @InputString
ELSE INSERT INTO @Items VALUES (@InputString)
RETURN
END -- End Function
GO
Use the below script:
create table Table1 (Product_Code varchar(50),Product_Desc varchar(10),sStart_date varchar(MAX))
Insert into Table1 Values('P00002933','VITAMINE C','2005,2000,2011,2001,2002'),
('P00003087','BIOFENAC','2011,2009,2006,2007,2004,2005')
Select Product_Code,Product_Desc ,MIN(Item) Minstart_date
From Table1 A
Cross apply Split(A.sStart_date,',') B
Group by Product_Code,Product_Desc
Drop table Table1 -
How to spool out put of multiple scripts and get a single spool file output
Hi,
I have one master script that calls three other scripts. The three scripts each produce their own spool files. But I would like to have the master script also produce one single output (in addition to the three indiviual output I mean). How to do that? Can you please help.
Following are the scripts:
--m.sql (master script)
spool c:\m.log
@1.sql
@2.sql
@3.sql
spool off
--1.sql
spool c:\1.log
insert into test values(1);
commit;
spool off
--2.sql
spool c:\2.log
insert into test values(2);
commit;
spool off
spool c:\3.log
insert into test values(3);
commit;
spool off
--table used
SQL> desc test
Name Null? Type
A NUMBERWhen I run the above script m.sql it does produce the other 3 log files (1.log,2.log etc) but m.log (which is master log file which should have output of each of the three calling script) is empty file with 0 byte!
Thanks
Edited by: orausern on May 1, 2011 3:17 AMI have one master script that calls three other scripts. The three scripts each produce their own spool files. But I would like to have the master script also produce one single output (in addition to the three indiviual output I mean). How to do that? Can you please help. Not sure if that's possible directly with sqlplus spool option
When you spool to a different file in a single session, sqlplus stops writing to earlier spool file and redirects the output to the file specified in last spool command.
at the end of the script, however, below may help
host type c:\1.log >> c:\m.log
host type c:\2.log >> c:\m.log
host type c:\3.log >> c:\m.log
Maybe you are looking for
-
I bought another iPad for my daugther. Because she has no PC, I loaded her iPad with apps from My PC. Now she is in Oceanside CA. And I am in Iraq with my iPad and PC.. My question is: How can my daughter load some apps of her own? If I buy her iT
-
Error 21470247770 when attempting to run macros in Project Server v2010
We have some new users to our Project Server that are getting the following error when they attempt to run our macros which are stored on the Enterprise Global: "System Error &H8007007E (-2147024770). The specified module could not be found." We hav
-
A helloworld java applet that will work on an html file
I have spent a lot of time trying to get a java applet to work on a web page. Of course, I can download zip packages and they will work. But I can?t seem to find a formula for creating something simple that will work. All the examples that I have fou
-
Hi, I am working with Solidworks Interface. With in SAP i am using the BADI IF_EX_DOCUMENT_NUMBER01~DOCNUMBER_CHECK, in this BADI i am validating the data and throwing a error message (MESSAGE E007(zz) WITH text-002). When i am creating the document
-
Hi, Can any one explain how to integrate OM,PM,TM,Payroll ? what r the paths ? and could u explain about Switches of PLOGI ORG? thanks, Mrudula.A