How to insert unique random values in 2 columns?
I have a table with 2 columnsCreate table code_for_code)
first_code varchar2 (10) unique not null,.
second_code varchar2 (10) not null unique);
and I want to make PL/SQL code to Insert unique values at random in two columns , for example 20 record... How can I do something like that?
DECLARE
i NUMBER := 0;
BEGIN
LOOP
INSERT INTO code_for_code
SELECT first_code, second_code
FROM (SELECT DBMS_RANDOM.STRING ('U', 20) first_code,
DBMS_RANDOM.STRING ('U', 20) second_code
FROM DUAL) a
WHERE NOT EXISTS (
SELECT 1
FROM code_for_code
WHERE first_code = a.first_code
AND second_code = a.second_code);
i := i + 1;
EXIT WHEN i >= 20;
END LOOP;
COMMIT;
END;
Tags: Database
Similar Questions
-
How show only last row value in a column of OBIEE
Hi Experts
How show only last row value in a column of OBIEE
Thank you
VHello
Pull column criteria, which you want to display only last row. Filter Advanced sql apply now to this column as a.
RCOMPTE ("customer D1". "C1 Cust Name") = MAX (RCOMPTE ("customer D1". " Cust C1 Cust Name name')) here is the column where I applied the filter.
So, it gives only last row in the name column of the Cust.Awarded points if the answer
Reference: http://forums.oracle.com/forums/ann.jspa?annID=939Kind regards
Srikanth
http://bintelligencegroup.WordPress.com/ -
How to use the prompt value in the column of the report
Hello
I have a quick report column which is 'Adj Type' that contains values 10,20,30, and when the user selects Adj Type = 10, this value should be passed on to the column of the report.
For example. Value in column 1 is 10 and this should multiple with the prompt value and production is expected to be 10 * 10.
Ideas how to capture the prompt values in the column of the report for the calculation.Hi hsekar,
(1) declare a presentation online in the section variable set Variable--> Variable--> P_var presentation
(2) in Fx Table_name. Your_column * @{P_Var}
@{P_var} {20} (20 is the default, it replaces when a user selects the value in the command prompt
Thank you
Saichand.v -
How Oracle to store geometry values in the columns of the table?
How Oracle to store geometry values in the columns of the table?Check this box:
[Oracle Spatial User guide | http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14255/toc.htm]Check other documents space here.
[http://www.oracle.com/pls/db102/portal.portal_db?selected=7]Published by: Anantha R on August 20, 2009 13:43
-
How to apply the random value "seed" to multiple images
So, I'm in a weird situation, have been surfing the net for the solution for more than a day now and can't really find the solution.
What is it?
Its a small school project I chose and can't really find a way to do it.
What I want to achieve?
I have an image and I want to have like 50 variations of it.
What have I done?
I have loaded an image, performed an action that applies the filter called "Wave", the wave dialog I selected a rangeminimum and maximum values.
The problem I have:
I made 50 copies of the same image, and then I applied the action through treatment for these 50 images in batches. However, it applies exactly the same settings/values that I saved. It does not really use the beach that is the maximum and minimum values , I selected in the wave dialog box. It seems that when I closed the wave dialog box, the action creates a new value called 'Random seed' when recording and maybe this number seed tells photoshop what to choose between the min and max range provided by the user.
So is it possible that when I run the action, he'll be looking for a new random value in the range max and the min provided?
Thank you
Marolina
Save the script below in the text with the .jsx extension. Replace the wave filter step in your action with a step that runs the script. The rest of the action can stay the same.
// seed range detemined by running the filter with the desired settings 10 times // and getting the lower and upper range from the scriptlistener log // the seed seems to depend on the other values. In another test the seed was // a 8 digit number var seed = Math.floor((192000-186000)*Math.random()) + 186001; app.activeDocument.activeLayer.applyWave(1,93,198,5,35,100,100,WaveType.SINE,UndefinedAreas.REPEATEDGEPIXELS,seed);
-
How to use the default value of a column in a table in insert or upda
Hello
I try to use the values by default so that the user should not have to enter data, but when I select default type and a default, I see an error message if I try to add a new line.
How can I use a default value to a column in a tabular presentation?
Gouri
Published by: user1046395 on April 3, 2009 09:58Gouri,
You can change simply to attribute each report column. For example,.
To set the default date.
Default type: PL/SQL Expression of function
Default: sysdateTo set the default text,
Default type: PL/SQL Expression of function
Default: * "CLERK."If you still get an error, what is the error message?
Tarraf -
How to dynamically change the value of a column in a report
Hi, I'm new to APEX and I have a small requirement. I have a report in a page which I query. Report will always have only one record. I need to change a value of a column in this report of the value received from another page. I was able to send the value of another page on my page of reports to a hidden page element, but I don't know how I can configure this value received to this column in the report. Is this possible? If Yes, can anyone help with this?
970829 wrote:
Please update your forum profile with a real handle instead of '970829 '.
Hi, I'm new to APEX and I have a small requirement. I have a report in a page which I query. Report will always have only one record. I need to change a value of a column in this report of the value received from another page. I was able to send the value of another page on my page of reports to a hidden page element, but I don't know how I can configure this value received to this column in the report. Is this possible? If Yes, can anyone help with this?
Not really clear exactly what it is you are trying to reach. You want to replace the value of a column in the report with the value of a page element? If so, simply replace the column in the report with a reference to the required page elementquery:
select empno , ename , job , :p2_sal sal -- Replace value of sal column with value of P2_SAL item from emp
-
Two tables provided, how you retrieve the values in two columns using values in a column (the pass get values. If col. A is not null values and get the pass. B if col. A is null)?
Guessing
Select nvl (x.col_a, y.col_b) the_column
from table_1 x,.
table_2 y
where x.pk = y.pk
Concerning
Etbin
-
How can I replace the value of the column with a particular value in SQL
Hi all
Is someone can you please tell me how can I format my output with the replacement of a column value with a specific value that really depends on the current value of the column
I am executing the following SQL statement
Select state, count (id) from < table_name > where composite_dn = < composite_dn_name > Group by State;
My current performance is:
State Instance number
1 3
3 28
I want to replace the value in the State column as follows
No.OfInstances State
3 filled
28 faulted
I want '1' to be reppaced of 'Done' and '3' is replaced by 'Faulted. '
Is is possible with SQL or PL/SQL, if it is then how I can achieve this required. Help, please!
Thanks in advance!
Published by: Roshni Shankar on October 27, 2012 12:38 AMHi Claude,.
I guess this CASE clause can be simulated by a DECODE and also it is very easy to use.
See - http://www.techonthenet.com/oracle/functions/decode.phpselect decode(t1.state,t2.state_id,t2.state_name), t1.count_id from
t2, (select state,count(id) count_id from where composite_dn= group by state) t1 where t1.state = t2.state_id; HTH
Vanessa B.Published by: Vanessa B on October 27, 2012 14:02
-link addedPublished by: Vanessa B on October 27, 2012 14:19
-added code sample -
How to insert a KPI by comparing two columns
I want to compare the value of date under "Start" column and value under the column 'BL1 Start' date and if they are same I want to use an indicator in another area and if not even, then one other indicator should be displayed in the same field.
Kindly let me know how to do it.
ConcerningIt is true that you can not use all of the 2 parameters (defined by the user and P6 standard fields as well incidentally) on both sides of the operator 'is' in the section 'if' of global change as a condition.
and since the use cases is there, personally I see no reason why this is impossible. If any-to-any field comparisons are allowed, any comparison without meaning of different data types should just return 0 as their value of truth (unfulfilled condition) or generate errors of global change report
Otherwise, more elegant solutions could include more complex "sentences" used as conditions, with more than one driver
for example if param_1< param_2="" -="">
where param_n is a field any (standard or user-defined)
also the choice of any parameter, but also the operators of drop-down lists should be limited depending on the data type of the or the previously selected parametersto answer your original question, the only solution I can think of is for you:
* 1.* create a user-defined field: my_kpi
* 2 use global_change_1 to calculate the value of my_kpi, based in any other number n standard, udf fields, and/or custom values, including PS, CD, current_date_time, substring(), etc to meet your needs.
Use 'then' as many lines as needed. No line 'if' required.
for example
my_kpi = param_1 + param_2
my_kpi = my_kpi * param_3
my_kpi = my_kpi - some_other_udf
my_kpi = my_kpi / {custom} division by 0 should be avoided as it will generate errorsIt's the equivalent of
my_kpi = ((param_1 + param_2) * param_3 - some_other_udf) / {custom}
you will probably need one ore two lines with simple divisions or added to calculate a relevant value for my_kpi.
for example
my_kpi = CD - planned finish
my_kpi = my_kpi - {contingency}* 3.* create another udf: my_indicator
* 4 use global_change_2 to assign values of color my_indicator
If my_kpi< minumum="" threshold,="" then="" my_indicator="red," else="" my_indicator="">
If you want a 3-color scale, you will need a more global change which will present the yellow flag.
the major drawback of this is that P6 does not (not even v7) solutions (scheduled tasks), action-triggered or even conditional running of global change as defined.
It would be nice to have lots of global change and have global_change_n triggered by the completion of the global_change_n-1, or even incorporate a global change (a reference to its definition) in the lines "then" or "else" to another planetary change.
This could improve significantly (or completely screw up :) the business logic of P6
concerning
Published by: [email protected] on October 7, 2009 19:08
Published by: [email protected] on October 7, 2009 19:12
-
How to insert Mutiple data in a single column
I have an E_CTIC_DTA table with a clob column
I want to insert all the data from EMP in this clob column that too in a single line
When each series of records must be in a new line.
for example: 121 AH 5000 50 131 MACIEL 1000 10 141 KING 5000 50
The text file should look like below when we choose the CLOB
121 50 5000 SALOME
131 1000 10 MACIEL
141 KING 5000 50
Any reference links or suggestions please...
Thanks in advance...Hello
A simple example:
DECLARE v_clob CLOB; v_line VARCHAR2(4000); BEGIN FOR reg IN (SELECT * FROM employees e) LOOP -- Loading new line (maybe using a procedure, etc). v_line := reg.employee_id || reg.first_name; -- Adding the line to the clob v_clob := v_clob || v_line || CHR(13); END LOOP; -- Inserting into the table INSERT INTO E_CTIC_DTA VALUES v_clob; COMMIT; END; /
Kind regards
-
How to highlight the minimum value in a column?
I need to highlight the lowest value in each column in my spreadsheet. I try to use the conditional nail, but I can't find a function to work as I need.
One way would be to calculate the minutes in a cell of a footer row, select the cells in the body of the column and apply conditional highlighting like this:
You must click on the chip address first, and then select the comparison cell, A8 here, then be sure to keep the row and column.
The A8 from the example formula is = MIN (A).
The result is a bold 2 (not shown in the screenshots).
SG
-
Hi Experts ADF,
JDev 12 c.
I create a button and a table below. If the user clicks on the button create, I invoke CreateInsert. The new line now appears as an editable fields.
So I suppose I have a column that is displayed in editable mode. If the user enters values in that. Has another column B whose value is not displayed in the UI must have the same value as the column.
This occurs for each row added. During the click on save if user entered 2 in column A, then the value in column B must be same 2.
Thank you
Roy
There is more than one way, for example:
Generate ViewRowImpl Java class (with generate audited accessors) you will get for an attribute setter.
Change the Set accessor to set the attribute B (IE, calling setAttribute ("B", value)) after setting a value
OR, write valueChangeListener for inputText representative and set the B attribute to the same value
-
How to set the default value of a column from the value of the 2 columns given
Is it possible to set the default value for a column A, as the concatenated values of columns B and C of the create table statement itself without using the trigger.
for example, in a line, if column B is 'James' and column C is "smith" then the column has must be "james Smith".
in another line if column B is 'Bob' and column C is "Taylor" then column should be "Bob Taylor"
Thank you
YGYes, it is possible. But what is your version of the database? Try to use "virtual column. Search for a virtual column in the following link.
http://www.Oracle.com/technology/pub/articles/Oracle-database-11g-top-features/11g-schemamanagement.html
http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_7002.htm -
How to assign a default value to a column?
Hello
Is it possible to alter a column in order to assign a default value for the column in the object browser?
I have a RECORD of table in which I want to assign a value to 0 by default to a column whose type is NUMBER.
Thank you for your kind replies.
Christian.Hello
In SQL, do something like:
ALTER TABLE FICHE MODIFY ("Fieldname" NUMBER(n, n) DEFAULT 0 NOT NULL ENABLE)
Replace Fieldname and n, n, as the case
Andy
Maybe you are looking for
-
"This website does not provide identity information" during video playback.
Hello, I have sign of insecurity connection during playback of youtube videos, either on facebook or youtube (for other sites, I don't know yet). When I put the pointer at him, he says "this website does not provide identity information. Why is this
-
Firefox crashes when I try to use then printer
I did not really see a response to my question, looking at the previous Q & A. So I'll try here. Just from today, every time I try to use my printer with firefox, I get a crash report? When I try to use the printer in another browser, no problem. I t
-
Satellite A210 - FN buttons do not work with another OS
Hello I reinstalled my Toshiba Satellite A210-1BX with another operating system WinMy problem is, that the Fn - button does not work and is not pop down on the top of the screen. Should what program or driver I install this function? I have installed
-
OK, so after a long conversation with the hp support I know that my drive is out on my envy touchsmart can anyone understand what hard drive I need because I know it will be cheaper to pay 200 hp and a week of waiting. Model #4 - 1115dx 500 GBalso ho
-
HP-15-1033wm: power on password on my HP-15-1033wm
I bought a HP laptop and when I turn on and try to start, he said: "Power on password" and when I tray several times display 'system off [77263935] '. The serial number is [redacted] Please, help me!