How to update unique number to records coming under 1 Hierarchy?
Hi,
I have the below table ,
CREATE TABLE TEMP2
ID NUMBER,
MATCH_ID NUMBER,
UniqueID NUMBER
below records available in the table temp2,
ID MATCH_ID UNIQUEID
1 2
1 3
1 4
2 5
3 7
5 9
10 11
12 13
SET DEFINE OFF;
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(1, 2, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(1, 3, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(1, 4, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(2, 5, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(3, 7, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(5, 9, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(10, 11, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(12, 13, NULL);
COMMIT;
requirement :
id 1 is matching with matchID 2,3,4 and 2 is matching with 5 and 3 is matching with 7 and 5 is matching with 9
here I want to give one unique sequnce to all the related hierarchy records,
How can i do this?
my output should like this,
ID MATCH_ID UNIQUEID
1 2 1
1 3 1
1 4 1
2 5 1
3 7 1
5 9 1
10 11 2
12 13 3
Any help appriciated..
You want something like this?
SQL> ed
Wrote file afiedt.buf
1 select id, match_id, dense_rank() over (order by par_id) as rnk
2 from (
3 select id, match_id, connect_by_root(id) as par_id
4 from temp2
5 connect by nocycle id = prior match_id
6 -- start with id not in (select match_id from temp2)
7 )
8* order by rnk
SQL> /
ID MATCH_ID RNK
612646357 612663043 1
612663043 612646357 1
612646600 612673275 2
612673275 612646600 2
612646602 612660746 3
612660746 612646602 3
612646816 612661509 4
612661509 612646816 4
612660746 612646602 5
612646602 612660746 5
612661509 612646816 6
612646816 612661509 6
612663043 612646357 7
612646357 612663043 7
612673275 612646600 8
612646600 612673275 8
16 rows selected.
Similar Messages
-
How to find the number of records per months in cube
Hi,
how to find the number of records per months for my all cubes?
Can i use the ListCube transaction to find totl number f records per cube monthwise ?
JimmyHi,
Here is a program to generate no of records and list of ODS and Cubes in Active version.Schedule this program in background and create a cube to load this information and schedule to the data from the file generated by the program. Schedule this all per you requirement.
1.Copy the code into your Z<programname> from Se38.
2.change the FILENAME in CALL FUNCTION 'GUI_DOWNLOAD' in the program to the location from where you can pick the information to load data to cube(eg Application server).
3.Save program.
4.Schedule the program in background as required
5.Create cube with infoobjects to hold no of records and Infoprovider name
6.Load this cube based on event after the program job is done.
Hence you can report on this cube to see no of records in CUBE or ODS in your box.
Please find the code below.
Cheers,
Kavitha Kamesh.
types: begin of itabs ,
tabname type dd02l-tabname,
end of itabs.
data: itab type itabs occurs 0 with header line.
data: counter type i.
data: begin of itab1 occurs 0,
tabname type dd02l-tabname,
counter type i,
end of itab1.
DATA: ITABTABNAME TYPE STRING.
DATA: LENGTH TYPE I.
DATA: OBJECT(30).
data: str(6) type c.
select tabname from dd02l into table itab where ( tabname LIKE '/BIC/F%' or tabname LIKE '/BIC/A%00' )
and TABCLASS = 'TRANSP' and AS4LOCAL = 'A'.
loop at itab.
select count(*) from (itab-tabname) into counter.
str = itab-tabname.
if str = '/BIC/F'.
LENGTH = STRLEN( ITAB-TABNAME ).
SHIFT itab-tabname BY 6 PLACES LEFT.
ELSEIf str = '/BIC/A'.
SHIFT itab-tabname BY 6 PLACES LEFT.
LENGTH = STRLEN( ITAB-TABNAME ).
LENGTH = LENGTH - 2.
endif.
itab1-tabname = itab-tabname(LENGTH).
append itab1.
itab1-counter = counter.
clear itab-tabname.
clear: COUNTER.
endloop.
*********** itab1
loop at itab1.
write:/ itab1-tabname, itab1-counter.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = 'c:records.xls'
FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = ','
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = itab1
* FIELDNAMES =
* 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
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
How to find the number of records in ods?
how to find the number of records in ods?
Pls suggest the solution apart going to the table of ods and seeing the number of records.
Is there any program or function module to see the number of records in ods?
For eg: SAP_INFOCUBE_DESIGNS is a program which gives the detail (number of records) of infocube.Hi,
I was looking at this and found the following tables that may be of help.
One of these tables will include a summary of the record count of all the tables in your system based on the last time each table had it's database statistics calculated:
DBSTATTADA
DBSTATTDB2
DBSTATTDB4
DBSTATTDB6
DBSTATTINF
DBSTATTMSS
DBSTATTORA
We run on an Oracle database so the table record counts can be taken from DBSTATTORA. Type in AZ in table selection field in SE16 to restrict the output to ODS (or DSO) tables only.
The record count is at the time indicated in the timestamp field. Obviously this is not real time but should not be too out of date - if it is you may be having performance issues and should get your DBA / Basis to run a full refresh of DB stats.
Hope this helps, alhtough not real time the table should give you a decent indication of the size of all your ODS objects (or any other table for that matter!) -
How to set the number of records displayed at run time
Is it possible to set the number of records displayed block property at run time? The built-in 'GET_BLOCK_PROPERTY' can retrieve the number of RECORDS_DISPLAYED. But I can't find SET_BLOCK_PROPERTY to set this property. Is there anyway I can set this property programmatically? Thanks for any suggestions!
Bookmark Go to End
goal: How to vary the number of records displayed in a block
programmatically
fact: Oracle Forms Developer
fix:
Block property 'Number of Records Displayed' can not be changed during runtime
using SET_BLOCK_PROPERTY. However, it is still possible programmatically change
the visual appearance of the form so that it creates effect of changing this
property. To achieve such an effect follow these steps:
1. in Forms Builder, in the multirecord block define the new set of items.
The simplest way is to copy/paste the original item and rename created item.
2. set properties of these new items so that they are the same as the properties
of the original items. If these new items were copied from original items
then properties are already the same. Modify following properties
'Database item' on new items to value 'No'
'Synchronize with item' to the value of the original item
'Number of Items Displayed' to desired value.
'Visible' to 'No'
In other words, these new items are mirrors of original items.
3. code event, which is meant to trigger the change in block appearance.
This code should use SET_ITEM_PROPERTY built-in to set properties
like 'VISIBLE', 'ENABLED', 'NAVIGABLE', 'UPDATE_ALLOWED' and others
to desired value for items which are about to be displayed, then
move cursor to one of these just displayed items with GO_ITEM built-in
and then hide the previously displayed items.
Example:
Assume that the block is built on SCOTT.DEPT schema. Following will
change the set of displayed items
set_item_property('dept.mdeptno',visible,property_true);
set_item_property('dept.mdname',visible,property_true);
set_item_property('dept.mloc',visible,property_true);
set_item_property('dept.mdeptno',enabled,property_true);
set_item_property('dept.mdname',enabled,property_true);
set_item_property('dept.mloc',enabled,property_true);
set_item_property('dept.mdeptno',update_allowed,property_true);
set_item_property('dept.mdname',update_allowed,property_true);
set_item_property('dept.mloc',update_allowed,property_true);
set_item_property('dept.mdeptno',navigable,property_true);
set_item_property('dept.mdname',navigable,property_true);
set_item_property('dept.mloc',navigable,property_true);
go_item('dept.mdeptno');
set_item_property('dept.deptno',visible,property_false);
set_item_property('dept.dname',visible,property_false);
set_item_property('dept.loc',visible,property_false);
Regards,
Monica -
How to update and insert the records without using Table_comparison and Map_operation?
Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE
-
How to update the millions of records in oracle database?
How to update the millions of records in oracle database?
table have contraints & index.how to do this mass update.normal update taking several hours.LostWorld wrote:
How to update the millions of records in oracle database?
table have contraints & index.how to do this mass update.normal update taking several hours.Please, refer to Tom Kyte's answer on your question
[How to Update millions or records in a table|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:6407993912330]
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
[Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/] -
How to update check number in general ledger and vendor ledger automatical
Dear All,
i need some clarification in check updation in general ledger and Vendor ledger through the system automatically.
While making vendor payment system will not update check details in vendor ledger and bank GL code.while doing bank reconcilation its very difficult to identify check no and amount for that we have updating manually but its time taking. Is there any program or any enahancement for updating check number in general ledger and vendor ledger.
Kindly suggest me how to update check number . Is there any programm or enahancement for check updation.kindly suggest me.
Thanks in advance
Thanks and Regards
GirishHI,
If I am understanding correctly what you are wanting is to be able to see the check number for the payment document in both FBL1N and FAGLL03.
Special fields for AP line item reporting can be configured via IMG. Define additional fields for line item display>
Not all fields are available, but this one is. Add this entry, you can also add check encashment date if desired.
PAYR table name.
CHECF Field name
After these fields are saved, they can be selected in the line item layout on FBL1N.
You may also need to reset the ALV buffer using program BALVBUFDEL
Resetting the buffer is only necessary once in each client.
Hope this helps.
Alicia -
How to find total number of records in a BDoc?
Dear all,
I have replicated about BP 1088 records from ISU into CRM system with block size 100. Technically on SMW01, for each successfully processed BDoc, there will be 100 records (corresponds to 100 block size). But due to some failed BDocs, not all "successfully" BDocs will have 100 records each, some may have only 1 record inside...or 30...or 88 for example. So, may i know how to find or is there a report i can look into to find the total number of records clearly shown for each of the successfully processed green status BDocs???
Please help and points will be rewards!!
Thank You
Best Regards,
CKI am just showing this to show how to get the rowcount along with the cursor, if the program has so much gap of between verifying the count(*) and opening the cursor.
Justin actually covered this, he said, oracle has to spend some resources to build this functionality. As it is not most often required, it does not makes much sence to see it as a built-in feature. However, if we must see the rowcount when we open the cursor, here is a way, but it is little bit expensive.
SQL> create table emp_crap as select * from emp where 1 = 2;
Table created.
SQL> declare
2 v_cnt number := 0;
3 zero_rows exception;
4 begin
5 for rec in (select * from (select rownum rn, e.ename from emp_crap e) order by 1 desc)
6 loop
7 if v_cnt = 0 then
8 v_cnt := rec.rn;
9 end if;
10 end loop;
11 if v_cnt = 0 then
12 raise zero_rows;
13 end if;
14 exception
15 when zero_rows then
16 dbms_output.put_line('No rows');
17 end;
18 /
No rows
PL/SQL procedure successfully completed.
-- Now, let us use the table, which has the data
SQL> declare
2 v_cnt number := 0;
3 zero_rows exception;
4 begin
5 for rec in (select * from
6 (select rownum rn, e.ename from emp e)
7 order by 1 desc)
8 loop
9 if v_cnt = 0 then
10 v_cnt := rec.rn;
11 dbms_output.put_line(v_cnt);
12 end if;
13 end loop;
14 if v_cnt = 0 then
15 raise zero_rows;
16 end if;
17 exception
18 when zero_rows then
19 dbms_output.put_line('No rows');
20 end;
21 /
14
PL/SQL procedure successfully completed.Thx,
Sri -
How to calculate the number of records in Multiprovider
Hi Experts
I have created a report based on the multiprovider (Consist of Cube and ODS)
I need count the number of records inside the multiprovider, how can i do it in the reporting level
Regards
SantoshHi,
You can use calculated key figure with replacement path variable.
Follow This:
1) From the context menu of the Key Figure directory, choose New Calculated Key Figure.
2) From the context menu for the Formula Variable, choose New Variable.
3) Choose the Processing type as Replacement Path.
4) In the next screen, select the Characteristic Info Object based on which the number of documents is to be displayed in the report (For example: Document Number / Order Number).
5) Choose Next.
In the Replace Variable with drop down box, choose Attribute Value.
In the Attribute drop down, select Characteristic Reference (Constant 1).
6)Choose Next.
On the Save Variable page, an overview of the settings made for the variable will be displayed.
Confirm the entries and Choose Finish.
7) If the Formula variable is directly assigned to the Calculated Key Figure, a warning Calculated Key Figure is not defined correctly will be displayed while executing the Query.
8) Properties of Calculated Key Figure dialog box, assign a Technical name for the CKF.
9) set the Time of Calculation to After Aggregation.
Hope this will help you.
Cheers,
DK
Edited by: Debasish Khaitan on May 14, 2009 1:03 PM -
How to update more than one records at one time
hello guys..
how to update a few records (more than one) with different
IDs at the same time? i tried to make a query like this (see
below), but only one record (more than one data in the same
field)has been updated.
<cfquery name="rec" datasource="DatKoku">
select *
from tbl_pilih
where id_pel = '#form.idpel#'
</cfquery>
<cfquery name="updtrecord" datasource="DatKoku">
update tbl_pilih
set
kptsn = '#form.suk_pil#',
trkh_kptsn =
'#Dateformat(TodayDate,"dd/mm/yy")#|#TimeFormat(Now(),"hh:mm:ss
tt")#'
where id_pel = '#rec.id_pel#'
</cfquery>
<cfquery name="outputrecord" datasource="DatKoku">
select *
from tbl_pilih
where id_pel = '#form.idpel#'
</cfquery>Take the query,
<cfquery name="rec" datasource="DatKoku">
select *
from tbl_pilih
where id_pel = '#form.idpel#'
</cfquery>
If every row in the table has a distinct id_pel, then what
you ask is actually an impossible question. It will have no answer.
Distinct IDs imply that the resultset will contain
at most one distinct value of id_pel. That means, there can
be at most one row that satisfies the condition,
where id_pel = '#rec.id_pel#' in the update query. That in
turn means the update query can update at most one row at a time.
If, however, the resultset of
rec consists of multiple rows, it will mean that there are
multiple rows in the table that have the same
id_pel . Then, your update query,
updtrecord, should update all the rows that share that value
of id_pel. -
How to get the number of records of a streaming result set
Hi guys.
So if it wasn't a streaming result set, I would have done this:
{noformat}myResultSet<code class="jive-code jive-java">.last();
{color:navy}*int*{color} numResults = </code>myResultSet<code class="jive-code jive-java">.getRow();
</code>myResultSet<code class="jive-code jive-java">.beforeFirst();
</code>{noformat}
but being a streaming result set, beforeFirst() throws an exception...
So how do you get the number of records in that result set? I wanna avoid an extra count(*) query, so I would appreciate other solutions than that.JoachimSauer wrote:
vanwil wrote:
you see, for now I just use a count(*) query to get the number of records, but that's adding a lot of extra waiting time...Iterating over the result twice will surely be slower then doing the count(*).great! so what I got now is actually the fastest way there is... awesome...
If you get an exception, then you surely have a stack trace. That should tell you what happens, or at least where.com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:2066)
Why do you need to know the number of elements beforehand, anyway?I need to know the number of elements because the incoming data goes into a table. Now of course, I could use ArrayList<String[]> or something, but wouldn't that require more memory resources than Object[][] ?
No one can tell you that, at least not without more information (say, the stack trace for example).Here's the exception message:
java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@10c0ef2 is still active. Only one streaming result set may be open and in use per-connection. Ensure that you have called .close() on any active result sets before attempting more queries. -
How to restrict the number of Records into the Table?
Is there any way that I can restrict the number of records can be entered into the table?
For example I have created a table TAB1 with size category 0( zero).
User dont want to enter more than 100 values, How to restrict the number entries? Whether Basis can do it?
Regards,
PrathapHi Prathap,
You can write a code in table maintenance events to restrict the number of Records added into the Table to constant.
Solution:
Se11 -> enter table name (TAB1) -> F6 -> Utlities -> Table maint. generator -> Envirnment -> modification -> events -> write here the form routine name.
Double click on routine name. You will get into include section of the code. Write here code like:
IF current_rec_num > 100.
messgae error 'Entry restriceted to 100'
ENDIF.
Somewhat this way you can achieve your target.
Regards,
Sachin -
How to set default number of records shown in report table?
How can I set the default number of records shown in a table report?
This is how report attributes page should look like and there is the number of rows where you enter whatever you need:
http://i44.tinypic.com/es95bn.gif
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
How to limit the number of records in WebI Report
Hi,
I have a requirement where I need to display the WebI Report data only if the number if record is less than 65k.
Incase if the records are more than 65k then the report should be blank and a text message needs to be displayed.
The client dont want to set the number of records either in universe or at the edit query at the report. They want to limit once the report is executed.
Please let me know if its possible to do it at the report level.
Thanks in advance!!
Best Regards
SAP BOOptional prompts are not a problem.
Assuming you first query uses the following SQL statement
select a,b,c from t where x=y and z=@prompt(...)
The query for checking the number of rows should use the following SQL code
select count(*) from t where x=y and z=@prompt(...)
The original query should be modified as follows
select a,b,c from t where x=y and z=@prompt(...) AND (select count(*) from t where x=y and z=@prompt(...)) < 65000
Regards,
Stratos -
How to handle a number of records in stored procedure?
i wanna handle a number of records in a stored procedure one by one.
what should i do?
can any one give me some sample about the following question?
Q:
tb_main,tb_attach are two tables.
i want to create a procedure to write off a record in tb_main. before do that, i want to write off all records in tb_attach which is related with the record to be written off in tb_main. and a procedure named pr_write_off_attach for writing off a record in tb_attach has been created already.
what should i do?
help!!
nullDg.dataProvider.length is the number of records in the ArrayCollection
Dg.rowCount is the number of visible rows.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui
Maybe you are looking for
-
Error while consuming secured portlets
Hi, We have the following usecase: - Producer - One taskflow which is given to anonymous role. Converted this task-flow to a portlet. - Consumer - We need to consume this portlet in another ADF application which is unsecured. Steps done: 1) Created a
-
Error message when sending photos as attachments in mail
When sending photos from i photo in mail I get an error message "Can't get paragraph 8 of content of outgoing message id 142504208. Invalid Index" I can send one photo at a time but no more than one. I have recently upgraded to leopard from panther.
-
Goods receipt sub critaria in vendor evaluation
In vendor evaluation there is one sub-critaria goods receipt under main critaria quality, in this how system calcutae the tax. i went through the sap help doc, in this it is mentiaoned that "When you run an automatic re-evaluation for a vendor, the s
-
Configuring receiver determination with multiple messages in BPM
I am configuring a BPM scenario which uses 3 abstract interfaces, one for receiving, 2 for sending. I need 2 abstract interfaces while sending because they use different message types. I have created a Receiver Determination for the 1st interface, bu
-
Cant install OS on Macbook Pro
Hello, Im trying to install Mac Os X from my internal optical drive on a new harddrive (formatted mac os journaled) and it doesn't seem to work. I tried both Snow leopard dvd and lion. Then I tried both dvd's with an external optical drive and same p