Retrive data with valid row only
Hi All,
Below is my source table.
CUST_ID CUST_NAME VALID_FLAG ROW_seq
010 A 0 1
020 B 1 2
030 C 0 3
040 D 0 4
050 E 1 5
060 F 0 6
070 G 1 7
080 H 0 8Source contains million of records in table and i do not want to load all at once. Also valid_flag is varchar2 and if it has flag 0 then it is valid record, and if it is 1, then it is invalid.
Now lets say, my batch size is 2. in that case, first batch should take
CUST_ID CUST_NAME VALID_FLAG ROW_seq
010 A 0 1
030 C 0 3second batch should take
CUST_ID CUST_NAME VALID_FLAG ROW_seq
040 D 0 4
060 F 0 6and third bacth should take
CUST_ID CUST_NAME VALID_FLAG ROW_seq
080 H 0 8How to get the valid number of records from table, while excluding invalid record. I have done it using PL/SQL procedure and it workd fine, but we are required to use only SQL statement to achive this.
How to achive same with SQL statement?
ace_friends22 wrote:
Hi All,
Below is my source table.
CUST_ID CUST_NAME VALID_FLAG ROW_seq
010 A 0 1
020 B 1 2
030 C 0 3
040 D 0 4
050 E 1 5
060 F 0 6
070 G 1 7
080 H 0 8Source contains million of records in table and i do not want to load all at once. Also valid_flag is varchar2 and if it has flag 0 then it is valid record, and if it is 1, then it is invalid.
How to get the valid number of records from table, while excluding invalid record. I have done it using PL/SQL procedure and it workd fine, but we are required to use only SQL statement to achive this.
How to achive same with SQL statement?Do you only want to have the count of valid records from the table?
select count(1) from table where valid_flag = '0'I'd consider a bitmap-index on valid_flag as well, to avoid full table scans on the source table.
Brgds
Johan
Similar Messages
-
Fetch Multiple row in repor to insert data with multiple rows .
Hi Friends
i want to Insert emp attendance .
There are 10 emp in company .they enter there arival time in attendance register .
i have two item
1--p1_att_date
2--p1_status
ATTEN_STATUS are PRESENT by default in selectlist .
i want, when i enter date in p1_att_date item and Press submit then generate a report with 10 employee and insert in_time in report and when press enter then data with 10 emp should insert in to table ABC .
i don't want to use tabularform for this .actully i don't want to use ADD_ROW option to ADD attendance for second emp.so please give me some solution.
Emp_ID ATTEN_DATE ATTEN_STATUS IN_TIME OUT_TIME
101 22-JAN-2009 PRESENT
102 22-JAN-2009 PRESENT
103 22-JAN-2009 PRESENT
104 22-JAN-2009 PRESENT
105 22-JAN-2009 PRESENT
106 22-JAN-2009 PRESENT
107 22-JAN-2009 PRESENT
108 22-JAN-2009 PRESENT
109 22-JAN-2009 PRESENT
110 22-JAN-2009 PRESENT
My table is :-
table Name --ABC
emp_id number;
atten_date date;
atten_status varchar2(12);
in_time timestemp;
out_time timestemp;
How can i do this.
Thanks
ManojHi Manoj,
You can create multiple records easily using a single, simple, form. However, you would surely have to enter in the times individually using a tabular form (otherwise, you would have to use the same form 10 times). You do not have to keep the Add Row option on the page - this functionality can be removed.
Andy -
Need a report column to hold data for one row only
Hey Guys,
I have a report which has a column that links to another page in my APEX application.
There is a requirement where only one of the rows in this report needs to have a link so I need the column to show the page link for one row and one row only.
The report will have about 5 rows at a time so is there a way to just make this link appear for the one row(it will be the top row) in the column attirbute in APEX? or can this be done in the SQL for the report?
Any help is much appreciated
Thanks
-MarkHi
The only way (I believe) to do this is within the SQL. Then you just wrap the column in a CASE statement and if it meets your criteria then build up the link and if not then display normally.
Something like this...
SELECT ename,
CASE WHEN empno = 7839
THEN '<a href="f?p='||:APP_ID||':4:'||:APP_SESSION||'::NO::P4_TARGET_ITEM:'||empno||'" >'||empno||'</a>'
ELSE TO_CHAR(empno)
END empno
FROM empCheers
Ben -
Write to spreadsheet file.vi is storing data in one row only.
The 8 points of data is going into one column in the spreadsheet. In the "Write to spreadsheet file string.vi" how do I write the 8 points to one row for each cycle?
I got this VI from NI's web a couple of years ago and forgot how to modify this part. I usume it is within the write file.vi.
Thank you in advance
SkipI just reread your original post and the way the "Write to Spreadsheet File.vi" that ships with LV works by default is to put 1D arrays into rows. I read your post backwards and told you how to put the data in a column. Sorry.
In any case, perhaps you need to make sure the Transpose input ISN'T true, and that the delimiter IS a tab.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Data with two rows in a single column
I have been working on a report with the customer due amounts shown in bucketed columns eg 1-30 , 31-60 etc for each Customer,
so for each column I want to show an additional row with the % of the due amounts for each bucketed column.
. The format of report should look like below in pivot/table view
|Customer| |Due1-30 | Due31-60 | Due60+ | Total |
|XYZ | | 3000 | 2000 | 5000 | 10000 |
| |%Due | 30% | 20% | 50% | 100% |
ABC….
I have to get the percentages on the measure values in a separate row(not as a seperate column). Could you please help me how to get result like the format what I have shown
Thanks,
BP
Edited by: user8116383 on May 6, 2011 8:55 AMHi
This can be achievable by using Pivot view.
1.In Columns field place the customer and place the measure lables in the rows field and the measure column in measure field.
2.Duplicate the measure column and name it as %Due and click more options on this duplicated column and click shown data as -> percent of -> Row
Thanks
Diney -
Order table data with comparing rows
Hi,
My question is...
I have table with with 5 columns this actually is been loaded from a file and there is no direct PK, but for that combination of columns as used to make them unique
code, person, case
Table X
CODE CASE OLD_ID NEW_ID PERSON AUTH
01 ab122 1234 0001 AU123 99393
07 vv353 7872 0919 FV982 78282
01 ab122 1982 9929 AU123 99393
04 hjsss 8839 8302 JK920 32320
01 ab122 0001 1982 AU123 99393
05 cg899 6728 32322 IKL020 65252
07 w353 0919 8282 FV982 78282
now I need to order this data comparing row values of old_id to new_id for each of the combinations of code, person, case
need output like below
Table X
CODE CASE OLD_ID NEW_ID PERSON AUTH
01 ab122 1234 0001 AU123 99393
01 ab122 0001 1982 AU123 99393
01 ab122 1982 9929 AU123 99393
04 hjsss 8839 8302 JK920 32320
05 cg899 6728 32322 IKL020 65252
07 vv353 7872 0919 FV982 78282
07 w353 0919 8282 FV982 78282
hot to get this result, any help is much appreciated..
Thanks,
AK.Yes you are right, I took it down to edit this in that time you have posted the message...
Question:
Table data need to be sorted by matching old_id with new_id
actual table : here rows are randomly arranged
Table X
CODE CASE OLD_ID NEW_ID PERSON AUTH
01 ab122 1234 0001 AU123 99393
07 vv353 7872 0919 FV982 78282
01 ab122 1982 9929 AU123 99393
04 hjsss 8839 8302 JK920 32320
01 ab122 0001 1982 AU123 99393
05 cg899 6728 32322 IKL020 65252
07 w353 0919 8282 FV982 78282
output table: here if you see old_id of row 2 is matched to new_id of row 1.. and so on
Table X
CODE CASE OLD_ID NEW_ID PERSON AUTH
01 ab122 1234 0001 AU123 99393
01 ab122 0001 1982 AU123 99393
01 ab122 1982 9929 AU123 99393
04 hjsss 8839 8302 JK920 32320
05 cg899 6728 32322 IKL020 65252
07 vv353 7872 0919 FV982 78282
07 w353 0919 8282 FV982 78282
so, I need a query where I can generate this output.. -
Force user to change cost center master data with validity date
Dear All!
we do have customer fields in table for cost centers (CSKS) and would like to force the user to do changes for these customer fields in combination with the change of the validity from/to date. I did not find any possibility to add this functionality with the customizing transaction OKEG or any other transaction. We now would need some good ideas from you as SAP experts!
Regards,Hi,
You can use COOMKS02 enhancement.
Regards,
Eli -
String field value convert into Date with validation
Dear all,
I need some help if someone can please?
Actually I am getting date in string format as 20110315 or 20111025 or so on. I could use to date function for this for conversion but what if 20091432 which is wrong so I can hadle this.
Actually I m using oracle 10g and using anonymous pl SQL block . Can't write function or procedure for this. So I am extracting all the data including date as above and setting some flag so if date is correct then y otherwise no. Pls help. I think I have described everything what exactly I want?
If date is correct then insert in the different table otherwise setting flag if date is not correct. I.e. bdate varchar2
Best regards,
Edited by: Irha10 on 26-Jul-2012 12:29Why wouldn't you be able to use a function or procedure in your anonymous block?
SQL> declare
2 --
3 function is_valid_date
4 ( p_str in varchar2
5 , p_format in varchar2 default 'yyyymmdd'
6 )
7 return varchar2
8 as
9 dt date;
10 begin
11 dt := to_date(p_str, p_format);
12 return 'Valid';
13 exception
14 when others
15 then
16 return 'Invalid';
17 end;
18 --
19 begin
20 for rec in ( select 20110315 str from dual union
21 select 20111025 from dual union
22 select 20091432 from dual
23 )
24
25 loop
26 dbms_output.put_line(rec.str||' '||is_valid_date(rec.str));
27 end loop;
28 end;
29 /
20091432 Invalid
20110315 Valid
20111025 Valid
PL/SQL procedure successfully completed.Just a small example, instead of dbms_output, you could do an update of a 'Valid' column etc. etc... -
Validating data in jsp with multiple rows editable using ADF
If we are developing a page using ADF that edits muliptle rows in a table(view object) , how de we validate data in a row against the data entered in other rows.
Suppose user entered data in row1 and row2 , i want to validate the data in row1 against data in row 2.Suppose the user is entering data in a web page with three rows, user is allowed to enter a value in row2 less than the value entered in row1. When user enter a value greater than the value in previous row, we need to show a message and show the fields with the values that caused the error.
-
Microsoft Visual Basic 2010 Express.
I am new to Visual Basic programing and i am trying to understand the relationships between Datasets, database, table Adaptors. I have to following code that is is giving me the following error" Unable to load, Update requires a valid DeleteCommand
when passed DataRow collection with deleted rows".
I can track the error and its located in "OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)" code. What am i missing?
It seems that i can delete the data on the DataGridView Table and it only displays the correct data. but my database is not updating, even though the data grid displays differently.I can determine this because, when i save the offset database, i have all
the previous uploads and all the rows that i wanted to delete are still there.
My final goal is to be able to import offset data from a CSV file, save this data on the pc, send a copy of this data to a NuermicUpDown so the customer can modify certain numbers. From here they download all the date to a controller. IF the customer
needs to modify the imported data, they can go to a tab with a data grid view and modify the table. They will also have to option to save the modified data into a csv file.
Im not sure if i am making this overcomplicated or if there is a easier way to program this.
CODE:
Private Function LoadOffSetData()
Dim LoadOffsetDialog As New OpenFileDialog 'create a new open file dialog and setup its parameters
LoadOffsetDialog.DefaultExt = "csv"
LoadOffsetDialog.Filter = "csv|*.csv"
LoadOffsetDialog.Title = "Load Offset Data"
LoadOffsetDialog.FileName = "RollCoaterOffset.csv"
If LoadOffsetDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then 'show the dialog and if the result is ok then
Try
Dim myStream As New System.IO.StreamReader(LoadOffsetDialog.OpenFile) 'try to open the file with a stream reader
If (myStream IsNot Nothing) Then 'if the file is valid
For Each oldRow As MaterionOffsetDataSet.OffsetTableRow In MaterionOffsetDataSet.OffsetTable.Rows
oldRow.Delete()
'delete all of the existing rows
Next
'OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)
Dim rowvalue As String
Dim cellvalue(25) As String
'Reading CSV file content
While myStream.Peek() <> -1
Dim NRow As MaterionOffsetDataSet.OffsetTableRow
rowvalue = myStream.ReadLine()
cellvalue = rowvalue.Split(","c) 'check what is ur separator
NRow = MaterionOffsetDataSet.OffsetTable.Rows.Add(cellvalue)
Me.OffsetTableTableAdapter.Update(NRow)
End While
Me.OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)
MainOffset.Value = OffsetTableTableAdapter.MainOffsetValue 'saves all the table offsets
to the offset numericUpDown registers in the main window
StationOffset01.Value = OffsetTableTableAdapter.Station01Value
StationOffset02.Value = OffsetTableTableAdapter.Station02Value
myStream.Close() 'close the stream
Return True
Else 'if we were not able to open the file then
MsgBox("Unable to load, check file name and location") 'let the operator know that the file wasn't able to open
Return False
End If
Catch ex As Exception
MsgBox("Unable to load, " + ex.Message)
Return False
End Try
Else
Return False
End If
End FunctionHello SaulMTZ,
>>I can track the error and its located in "OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)" code. What am i missing?
This error usually shows that you do not initialize the
DeleteCommand object, you could check this
article to see if you get a workaround.
>> Im not sure if i am making this overcomplicated or if there is a easier way to program this.
If you are working CSV file, you could use OleDB to read it which would treat the CSV file as a Table:
http://www.codeproject.com/Articles/27802/Using-OleDb-to-Import-Text-Files-tab-CSV-custom
which seems to be easier (in my opinion).
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
ALE BOM. Updates ALL! items with validity date & change no.
Hi All,
We are having problems where ALE-BOM sent with change in validity date (with change no) to a particular item. What happens is that ALE-BOM will instead update ALL! items with the same validity date and change number.
Next,when we process ALE again for the same BOM with a different validity date(with change no), then only that
particular item is updated with validity date and change no.
Would anyone know what could be the problem that when changes are sent for the first time all items are updated?
[Version: SAP 4.6C/ SAPKH46C48]
Regards,
NeethDear:
The error itself telling you the correction. You profit center which is assigned to your cost center has a validity date less than the one you are now assigning.You can check in KE52 against the profit center assigned to your cost center master data. However the best thing is to go to KS01 and create this cost center with desired validity date.
This will resolve your issue.
Regards -
IBM SVC console uses websphere. Screen data that is presented in table form last row appears to overwrite the prior row only. In other similar layouts, the last row is cut in half and cannot be seen. The prior version of Firefox 3 (something) did not have this problem. OS Windows XP Pro SP3
Firefox V3.6.17 worked fineSeeing the same problem using the HMC with FF7 beta.
-
Best way to export data with r.t. prompts and have dense dim mbrs on rows?
Hi All-
What is the best way to export data with Run time prompts out of Essbase?
One thought was to use Business Rules with run time variables and DATAEXPORT command, but I came across at least one limitation where I cannot have months (part of dense Time Periods dimension) on rows.
I have only two dense dimensions: Accounts and Time Periods and I need both of these on rows. This would come handy when user enter Start and End month and year for data to be exported e.g. If start period is Feb 2010 and end is Jan 2011, I get data for all months in 2010 and 2011.
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000",14202.24,14341.62,14560,13557.54,11711.92,10261.58,12540.31,15307.83,16232.88,17054.62,18121.76,18236
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000",19241,21372.84,21008.4,18952.75,23442.13,19938.18,22689.61,23729.29,22807.48,23365,23915.3,24253
"CORP1","0173","FY11","Working","Budget","Local","HSP_InputValue","404000",21364,22970.37,23186,27302,25144.38,27847.91,27632.11,29007.39,24749.42,27183.39,26599,27112.79
where ideally I would need to get the following:
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Feb",14341.62
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Mar",14560
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Apr",13557.54
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","May",11711.92
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Jun",10261.58
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Jul",12540.31
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Aug",15307.83
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Sep",16232.88
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Oct",17054.62
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Nov",18121.76
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","402000","Dec",18236
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Feb",21372.84
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Mar",21008.4,
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Apr",18952.75
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","May",23442.13
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Jun",19938.18
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Jul",22689.61
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Aug",23729.29
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Sep",22807.48
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Oct",23365
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Nov",23915.3
"CORP1","0173","FY10","Working","Budget","Local","HSP_InputValue","403000","Dec",24253
"CORP1","0173","FY11","Working","Budget","Local","HSP_InputValue","404000","Jan",21364
Thank you in advance for any tips.Have a read of the following post :- export data to sql
It may give you a further option.
Cheers
John
http://john-goodwin.blogspot.com/ -
Working with Validation of Data
Hi. VC Experts.
I am currently working with VC 6.0. Where I am working with Validation of Data.
we have fields like Emp, Earea, Joining date (month & Year), Ending date((month & Year) etc.,
Here we have one push button 'select'.
Here what my client asks is unless and until, user fills all details then only
the submit but should be enabled. Otherwise submit button should be in disable mode.
I could be able to write formula for 'submit' button's properties( Disable) like this.
BOOL(IF(LEN(@Emp_code)<>0 AND LEN(@Earea)<>0 AND LEN(@Edept)<>0 AND DSUB(DVAL(@Joining_date), DVAL(@Ending_date),'D')<0 ,false,true))
Here condition is always make sure that 'Joining date' should be greater than 'Ending date' . where it is working fine for all fields except Calender Year month(Joining date & Ending date).
the calender year month format is Example : """" May 2007""""
But it is considering only month But not year.
Can you kindly provide your inputs.
Thanks & RegardsHi Vijay,
sorry
please rewrite the formula for the button disable as::
NOTE:: in the formula i have used '<''>' which nothing but a lessthan symbol and greater than symbol without single quotes (i.e. not equal to)
BOOL(IF(LEN(@Emp_code) '<''>'0 AND LEN(@Earea)'<''>'0 AND LEN(@Edept)'<''>'0 AND DSUB(DVAL(@Joining_date), DVAL(@Ending_date),'D')<0 ,false,true))
and make sure you have placed the date picker UI controls for your date functionality.
this will not work for calender UI control on the form.
and othe important point is the joining date should be less than ending date then only the button will be enable..
if you want your joining date should be greater than ending date then write the formaula like this::
BOOL(IF(LEN(@Emp_code)<>0 AND LEN(@Earea)'<''>'0 AND LEN(@Edept)'<''>'0 AND DSUB(DVAL(@Joining_date), DVAL(@Ending_date),'D')>0 ,false,true))
i tried this
its working for me
Regards
Srinivas -
X-distr.chain status in combination with valid from date
Hello I am using MM02 X-distr.chain status in combination with valid from date, to give materials a certain status in the sales order depending on the delivery date of the orderline.
How can I enter multiple statuses with future validation dates?
example following status with validation dates where entered in MM02 for a material
- material should have status A valid from January
- material should have status B valid form April
- material should have status C valid from July
- material should have status D valid from September
When I enter a sales order with delivery date in January system replies with status C.
When I enter a sales order with delivery date in April system replies with status C .
When I enter a sales order with delivery date in July system replies with status C .
When I enter a sales order with delivery date in September system replies with status D.
So only the current ( or previous status when current is not valid yet) is retained by the system.
How could multiple statuses be used?
Thanks in advance
JoosHello Jalo,
Thanks for your reply,
My customer sell season relevant materials so they want to control order entry and delivery creation based on predefined dates.
Status A = material is blocked for order entry and delivery creation
Status B = material is allowed for order entry, delivery creation is blocked
Status C = material is allowed for order entry and delivery creation.
Status D = material is blocked for order entry, delivery creation is allowed.
I had hoped to use standard functionality with this status field, it meets most of my customers requirements but at this moment the only alternative is to create a new table where this data can defined and create some abap logic in the user exit to set the status base on the table information.
Regards
Joos
Maybe you are looking for
-
Having trouble setting up headset with microphone
Hi, I own a satellite A135 that is currently running on Windows Vista Home Edition. I tried using a headset with mic but somehow the mic always turns to mute after I've exited the set-up page. I'm starting to get frustrated, particularly since I need
-
Dear all, We have configured item interest calculation. That is if the payment term is 25 days from the date of invoice, the grace days is 3 days. So if the payment is made on the 28th day, the interest should not calculate but if the payment is made
-
HT201412 Does not return to the Home screen after pressing the Home button
My home button it's not works after pressing If I press it hard many time it's work but sometime not working at all. Can any apple store fixed this problem in any apple store at any country cause I purchased from apple stroe in Brighton and I live in
-
Went to use Facetime and my MB Pro said there was no camera available.
Hi, I tried to use Face Time and my MBPro said there was no camera available. Same thing happened when I tried to use Photo Booth. Any ideas? Thanks.
-
Shared Members in Duplicate Members Hierarchy
It seems that many people have asked this question on this forum but I am yet to find a solution. Most of the posts were about 5 years old so I am hoping maybe something new has happened since. I have a dimension that has a regular and alternate hie