Generate GUID (unique number random)...
hi,
i have a situation, i want to generate a GUID, a random alphanumeric numbers in the pattern like below.
f2157b31-fded-11d8-ae89-15c8e06e3da2
how can i do that.
thanks
It's not going to be very useful as a key if it's random.
get Random to deliver you an int between 1 and 36. Map the
numbers to the numbers 0-9 and the letters a-z.
Repeat as necessary to fill in your pattern.
Similar Messages
-
Generate an unique number without sequence
Hello,
I need generate an unique number without sequence. I am using Oracle 11.2, here is the details. The column idSeq is unique withing one specific idType. I don't want a sequence for each idType.
create table tb_test (idSeq number(5), idType number(5), addr varchar2(256));
insert into tb_test
(select case when idSeq is null then 1 else max(idSeq)+1 end, 3, 'Main street');
I am having ORA-00937 : not a single-group group function error, any suggestion?
Edited by: 939569 on 13-Feb-2013 11:21 AMHi,
939569 wrote:
Hello,
I need generate an unique number without sequence. Explain what you're trying to do, and why a sequence won't do it.
I am using Oracle 11.2, here is the details. The column idSeq is unique withing one specific idType. I don't want a sequence for each idType.
create table tb_test (idSeq number(5), idType number(5), addr varchar2(256));
insert into tb_test
(select case when idSeq is null then 1 else max(idSeq)+1 end, 3, 'Main street');
I am having ORA-00937 : not a single-group group function error,Right. Since the sub-query is using an aggregate function (MAX), everything in the SELECT clause must be an aggregate, a group by expression, a constant, or something that depends entirely on them. In this example, the CASE expression depends on idSeq, which is not an aggregate, not a group by expression (there is no GROUP BY clause) and not a constant.
Also, the sub-query must have a FROM clause. All queries and sub-queries in Oracle require a FROM clause.
any suggestion?Use a sequence. The numbers won't be consecutive within each idType, but what does that matter? Chances are, no matter what you do, you won't be able to maintain consecutive numbers within each idType anyway.
If you won't use a sequence, then you can try:
INSERT INTO tb_test (idSeq, idType, addr)
SELECT 1 + NVL ( MAX (id_seq)
, 0
, 3
, 'Main street;
FROM tb_test
WHERE idType = 3
; -
Function module to generate a unique number in report based on descrepency
hi friends,
i have a object that..
Every discrepancy Should Have a unique number in the report, which calls based on the discrepancy (dc_qty)-(recd_qty)=shortage
the shortage value will be always positive,n not <=0..
is there any function module which should generate a unque no
based on passing MBLNR..
or any other way...
Thanks n regards
harishuse following funtion module
call function 'NUMBER_GET_NEXT'
exporting
nr_range_nr = '01'
object = 'ZBDCMSC2N'
importing
number = file_no
exceptions
interval_not_found = 1
number_range_not_intern = 2
object_not_found = 3
quantity_is_0 = 4
quantity_is_not_1 = 5
interval_overflow = 6
buffer_overflow = 7
others = 8.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
in This
Creat a number Range object(ZBDCMSC2N') using transction SNRO.
for any problem revert back.
regards
Rajesh -
How to generate Serial(Unique) Number for finished goods?
Guru's,
How do i generate Serial(Unique) Numbers for finished goods.Suppose,if we get an order for a finished good A of 10 qty.We want to generate unique number to identify each and every A item separately for quality purpose.Any help is much appreciated.
thanks Guru'sDepending on serial control of item, you will need to generate serial numbers at the time of WIP Completion transaction using Serial Entry window (i.e. if serial control is At Receipt) or at the time of job creation (i.e. if you are using serial control as predefined)
In latter case, you will have to use MES or MSCA screens to perform serialized WIP completion.
Thanks,
Hrishi -
How to select random and unique number
hi all
suppose i have millions of rows in emp table
i want to select group of empno
group of records would be 10
all records uniquely selected
make sure all records are selected in any Group
thanksBluShadow wrote:
Solomon Yakobson wrote:
3360 wrote:
It is the definition of random that the each value generated has an equal chance of being generated again. A coin toss is random despite the result only having two values.Absolutely. Except one little thing. The above applies if we randomly pick from same set. Now OP asked to randomly select group of objects. This is same as you have a set of unique objects and you randomly pick one and put it in your pocket. Then you randomly pick another object and put it in your pocket. So you end up with a UNIQUE set of randomly picked objects in your pocket. Now DBMS_RANDOM allows to specify low & high value but it doesn't allow to provide something like "pick N values" or except list to mimick "put in your pocket" part. That is why we have to write something like I suggested to OP.
SY.In that case it should just be an answer like...
select * from tablename where rownum <= 10because the order is not guaranteed without an order by clause and therefore that's just as random as needed to meet the requirements. ;)hi BluShadow
rownum surely give unique number of records but it will not A RANDOM....
thanks -
How to generate a unique 8 byte number for a String in DES
Hi All,
Is there any way to generate a unique 8 byte number representation of String?
I know it can be done with DES encryption (while MD5 gives 16 bytes number). My requirement is:
Every time a String is passed - my static method should return the same unique number - all the time.
i.e A String "AAAAAA" will return same unique number all the time. How can I achieve this (8 byte number) by DES Encryption or any other encryption?
Thanking all in advance.Thanks for your reply. Won't there be any loss of data if I consider only first 8 bytes? Will Integrity be maintained.?
In some cases my Strings can be unusually long - having length of 400 to 500.
I want 8 bytes as I want to map the number with MySQL bigint field. -
UDF to generate 4-Digit Positive Random Number
Hi,
I want to generate 4-Digit Positive Random Number in the Mapping for a field. Could anyone please provide Inputs or a UDF.
Regards,
VarunThis is the UDF I have Used
java.util.Random randomNumber;
String TransactionId = "" ;
randomNumber = new Random();
long longNumber = randomNumber.nextLong();
if (longNumber < 0)
longNumber = longNumber * (-1);
longNumber += 10000;
TransactionId = (String.valueOf(longNumber)).substring(0, 4);
return TransactionId ;
Thanks everyone for your Inputs -
Generating GUID with ora:generateGUID()
Hi,
generateGUID generates GUID like this:
af46278784e183e2:296f76:109e34c77ea:-7ff1
However, the standard format for GUID according to RFC 4122 (http://www.ietf.org/rfc/rfc4122.txt) is like this:
E7BF873B-37D1-4209-9332-E843BA71BD23
Oracle's GUID have 37 digits whereas standard GUID have 32 hex digits (16 bytes).
Does anybody know how Oracle BPEL GUID are generated, what is the algorithm? How is it related to standard GUID?
I would also like to know if the network address or an random number is used. This is important because if the network address is used there could be some collisions if there are several BPEL engines in the same host.
I have created a simple process with a FlowN activity to generate multiple GUID and is generating consecutive GUID; that's OK; and it means GUID generator is serializing requests. Could it be a bottleneck? Does it write to database or is it just a synchronized static Java class?
Thanks.quick comment,
we use java.rmi.dgc.VMID internally ..
/clemens -
How to generate a Unique key based on a some String value
Hello every one,
I am sorry , If I post this question in wrong group... I have a requirement to generate a unique key ( what every it may be alpha, numeric or alpha numeric) based on some String..
For ex : String str = "AbCX" - Gives a unique key based on "AbCX" value..
Is there any way we can get the unique value using Java ?
ThanksMay be not what you are looking for, but here's may idea:
use a sequence (db sequence) and add it the the string value. This way the value is unique, because the sequence is unique. So you could omit the string theoretically, but your requirement is met.
It's very easy to get a unique sequence number from the db using java, depending of the technology you use (which you did not say :-( )
Timo -
How Can I Print A Unique Number on a Series of PDF documents?
I have a weird question that I could not find an answer for via search previous questions. I essentaily have a PDF flyer that I want to print X copies of (where as X is a number, 50, 150, whateve amount I need at the moment). I want to have a unqiue number printed on each copy (sort of like a serial number). So Copy 1 would have a number of 909, copy 2 would have a new numbe,r say 910. The unique number could be random or in series (not important which). I'm wondering if this is possible within Adobe Acrobat X or InDesign CS5?
Yes, it's possible with Acrobat, but it requires a bit of scripting. You'll
need to set up:
- A print-only text field
- A script that will launch before the file is printed and update that
field (either by incrementing it or by giving it a random value)
- A script that sends the same file X times to the printer (you can't just
print X copies, because then the field won't update) -
Can I add a ticket number or request number (tracking number) to a form when a person fills out and hits submit. Then when they receive their submission notice can they get that number?
You need to generate unique number with the ID column and add an action in the submit button to show message. Refer to the following post for more information
http://www.infopathdev.com/forums/t/28374.aspx
http://www.infopathdev.com/forums/t/22295.aspx
http://blogs.technet.com/b/jessmeats/archive/2009/08/10/generating-a-unique-form-number.aspx
--Cheers -
Need SQL statement to generate a sequence number in the output rows
Hi folks. I need to create an SQL statement that generates a sequence number column in the output rows (records) such that the first returned row has this column set to 1, second returned row has the column set to 2, etc.
For example, consider the query:
SELECT income from employees WHERE income != 20000 ORDER BY income;
If employees.income contains 60,000, 20,000, 35,000, and 19,000 for respective rows, the output would be this:
19,000
35,000
60,000
I would like the SQL to also return a sequence number that is computed across the returned rows, resulting in two output columns:
1 19,000
2 35,000
3 60,000
Is there a simple SQL function that generates the sequence number, in order, and only for the returned rows? Or is there another way?
I'm stumped. Any help is appreciated! Thanks!
- Jack CochraneHi,
Welcome to the forum!
Use ROWNUM, like (example):
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL> select rownum, first_name from (select e.first_name from employees e where e.first_name like 'J%' order by e.first_name);
ROWNUM FIRST_NAME
1 Jack
2 James
3 James
4 Janette
5 Jason
6 Jean
7 Jennifer
8 Jennifer
9 John
10 John
11 John
12 Jonathon
13 Jose Manuel
14 Joshua
15 Julia
16 Julia
16 rows selected
SQL> But rememeber if you want to be sure of unique numbers in certain field is better to use sequences and use seq_name.nextval each time you need.
Regards, -
How to best generate a unique alphanumeric key
Hi:
I have a requirement to generate a unique alphanumeric key 20 characters long.
I know that I can use sys.dbms_random.string('X', 20) but I also have a requirement to not include certain characters that could be missread, i.e. no 0 (zero), O(uppercase oh) and a few others.
My questions are:
1) Is there a way to tell dbms_random to not include certain characters in the key generation
2) If the answer to 1 is No, what would be the best way to replace the unwanted characters. I am thinking just do a translate right afterwards with a randomly generated set of characters that do not include the characters I am interested in and seeded
upon package initialization. Any other ideas.
3) Is there a better way of meeting this requirement within PL/SQL?
Thanks,
ThomasThe most safe would be to use something like below if efficient enough
select listagg(x.ltr,'') within group (order by y.step desc) key
from (select level lvl,
substr(:alphabet,level,1) ltr
from dual
connect by level <= length(:alphabet)
) x,
(with
to_base(step,num,base,quot,remain) as
(select 1 step,num,base,trunc(num / base) quot,mod(num,base) remain
from (select :sequence_value num,length(:alphabet) base
from dual
where :sequence_value between power(length(:alphabet),:key_length - 1)
and power(length(:alphabet),:key_length) - 1
union all
select step + 1,quot,base,trunc(quot / base),mod(quot,base)
from to_base
where num > 0
select step,remain
from to_base
where num > 0
) y
where x.lvl = y.remain + 1
Regards
Etbin -
How to generate a unique WSDL for two webservices ?
Hi ,
Does anyone know if there is a way to generate a unique WSDL file for two webservices ?
Actually, the problem is more general. I have two EJB that are exposed through web services. They both contain a simple data structure that is passed back and forth.
The Client is a C# GUI and it is having problems with that data structure. Even if it is the same data structure with the same namespace, it seems it as two different objects and so creates two different stubs ...
I am trying to work around that from the server side, bc it does not seem that we can do it from the C# application.
First, I am trying to generate just one WSDL that would include both webservices but I can't seem to find an easy way of doing that.
Second, I have heard that the complex types could be referenced externaly and I think that it would do the trick as well. I don't know how to do that either.
I am using ServiceGen Ant tags to generate my web services from an EJB.
Did anyone encounter that issue ?
Can any one help ?
Thanks a lot
Farezhi,
go to t-code SNRO and create a number range from 0 to 99999999.
call the below fm in the report by passing the created number range name to fm to generate the new number every time..
see
NUMBER_GET_NEXT Get next free number in a range
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
NR_RANGE_NR = '01'
OBJECT = 'YPOLLID' "number range name created in SNRO.
IMPORTING
NUMBER = LS_NUMBER. "new number with one increment..
or
you can try..
you can use following code.
select max( num ) from z_table into v_max_num.
v_max_num = v_max_num+1.
Regards,
prabhudas -
Generate a serial number?
Can I set up a sheet so that there is a column that automtically generates a serial number?
Can you tell us more? Is there any special format to the serial numbers you want? Are they digits or a letters or a combination of both?
The random number generator (the RAND() or RANDBETWEEN() function) will generate a random number but the number will change every time you make a change to a cell or open your file.
You can have a cell that generates a random number using the RAND() function as part of the formula. You can copy and "paste values" that random number to another cell to "lock in" that number.
You can create a column of cells that generate random numbers. You can copy one of them and "paste values" back into the cell to lock that particular one in.
You can format these cells so all digits (including any leading zeros) are displayed and so that there are dashes or other punctuation between every so many digits, etc.
Maybe you are looking for
-
Premiere Pro 2.0 - output is lossy/blocky
I've been having trouble with PP2, in that my shiny source footage exports as lossy/blocky/pixelated no matter which codec etc I use. If I try to burn direct to DVD, I get the "insufficient space on the disc" error. Even if I do nothing except impo
-
A way to fetch the NW port number in BLS
Anybody know of a good way to fetch the port number of your NW instance purely in BLS? In the past I've used location.port in javascrpt, but in this application I need it to be an all BLS transaction (there's no user intereface) Ideas?
-
TERMINFO environment dropped when using sudo -E or sudioedit
Hey guys, I use the termite terminal which uses the termcap file 'xterm-termite'. Since this is non-standard I have to copy over the termcap file to remote machines I commonly work on. I put this file in `$HOME/.local/share/terminfo/x/xterm-termite`
-
Returning a ref cursor on a Global Temporary table
I realize this is probably not feasible but I am manipulating data and storing it in a GTT and I wish to return that transformed data out as a ref cursor is this possible to do? I also dont want a static table because this is a heavily hit procedure
-
Vietnamese Character in PO printing
Hi, Were doing SAP vietnam, one challenging is how to make the PO prinout capture the Vendor Name written in Vietnamese character.. The vendor master name is created/entered in the vietnamese character, during PO creation, the correct vendor name in