Repeating column values

Hi Experts,

I have a person in the table and its structure is given below.

ID sex name
101mRavi
506mBigot
103msrinu
104mVijay
105fManju
106mKiran
107mREDA
108mBelli
109fMallika
110mKCR

My requirement is to select random 5 females.

to do this, I wrote under request

{code}

SELECT *.

FROM (SELECT p.ID, p.sex

PERSON p

WHERE p.sex = 'F')

WHERE ROWNUM < = 5;

{code}

Here I'm getting 2 females but I need to repeat values such as

ID sex name
105fManju
109fMallika
105fManju
109fMallika
105fManju

Could you please help me on this.

Hello

Sorry for the confusion.

I select random 5 female candidates in the person table.

My requirement is if women candidates are less than 5 (suppose I have 2) then I need to repeat these women candidates.

Note: I used synonymous with gender equality at the level of the table so I think that it has been adopted

Thanks for the reply.

Tags: Database

Similar Questions

  • Repeat the value of the column derived from formulas

    I need to repeat a value derived for a particular combination of column and line to all the rows in the table. However when I put the 'case' function it does not repeat the values I want. The value is displayed only in the line of 1at

    The formulas used are the following

    CASE WHEN D_MILLS.MILL_NO = 1 THEN (F_MILL_PRODUCTION. FN_YTD_CPO_PRODUCED/F_MILL_PRODUCTION. FN_YTD_CROP_PROCESSED) ELSE (FILTER (F_MILL_PRODUCTION. FN_YTD_CPO_PRODUCED/F_MILL_PRODUCTION. WITH THE HELP OF FN_YTD_CROP_PROCESSED (D_MILLS.MILL_NO = 1.00))) END


    Note: No. Mill is the Dimension user for the report on the ground that I have. and I need the value of the derivative for mill = 1 to be repeated for all the other mills (mill No. = 2,3, etc.)

    Published by: Shaz01 on August 7, 2010 01:45

    Hello

    Use the formula like this,

    Max (CASE WHEN D_MILLS.MILL_NO = 1 THEN (F_MILL_PRODUCTION. FN_YTD_CPO_PRODUCED/F_MILL_PRODUCTION. FN_YTD_CROP_PROCESSED) ELSE (FILTER (F_MILL_PRODUCTION. FN_YTD_CPO_PRODUCED/F_MILL_PRODUCTION. (WITH THE HELP OF FN_YTD_CROP_PROCESSED (D_MILLS.MILL_NO = 1.00))) END)

    You must also, for all values don't indicate the value of factory No 1, so no need of instruction box.

    MAX (FILTER (F_MILL_PRODUCTION. FN_YTD_CPO_PRODUCED/F_MILL_PRODUCTION. WITH THE HELP OF FN_YTD_CROP_PROCESSED (D_MILLS.MILL_NO = 1.00)))

    Thank you
    Vino

  • Creation of buckets to column values

    Hey Joe,

    I'm repeating the question here again to make it clear.

    I have the column and its values are:
    Age of Orderdate * 9 10 12 14 15 18 19 20 21 22 26 27 28 29 33 34 40 45 * and so on

    But the requirement is the column values should be displayed in form

    Age by order date 15 1 2 3 4 5 6 7 8 9 10 11 - 16-20 21-25, 26-30 30 +.


    I created the buckets on the location tab. The result is, I got buckets 9 10 11-15 16-20 21-25, 26-30 30 +.
    but not got 1 2 3 4 5 6 and 7 8 buckets as I do not have the values under them for the moment, but in the future, I can get the values.
    Now my question is how to get those buckets as well.



    Kind regards
    Hervé Rama

    Hi Richard,

    Thanks for the screenshot.

    David is correct. One way to solve this problem would be to create columns of logic in the RPD... 1 for each group. But which leaves you with a bit of work ahead of you in terms of development of the RPD. In addition, if these groups are changing, you must rework the RPD.

    If time is a factor, you go ahead and use the method of David.

    In the meantime, I'll work with the functionality of Bin and see if I can get this and running side report.

    Best regards

    -Joe

  • By the way a column value to Javascript

    Hi all

    I have an interactive relationship with the following SQL:

    Select

    EmpNo,

    Ename,

    "< a href =" # "onclick = 'test ("show it");' > ' |" jobs jobs | "< /a > ' job

    de)

    Select 10 empno, ename 'John', 'Manager' of the double job

    Union

    Select the 20 empno, ename 'Bookmark', 'Clerk' double work

    )

    Here is the definition of the test() function:

    < script type = "text/javascript" >

    function test (x) {}

    Window.Alert (x);

    }

    < /script >

    The report works very well. I can click on the column values of work e.g. Manager, the value hardcoded clerk alerts and function 'show it '. I want to show the value of employment, so if I click Manager, the alert must be 'Manager' and if I click on clerk then the alert should be "clerk." I tried to call the function like test(#job#) but no use.

    Help, please.

    Thank you

    ZKay wrote:

    I have an interactive relationship with the following SQL:

    Select

    EmpNo,

    Ename,

    '' | job |'' as job

    de)

    Select 10 empno, ename 'John', 'Manager' of the double job

    Union

    Select the 20 empno, ename 'Bookmark', 'Clerk' double work

    )

    Here is the definition of the test() function:

    The report works very well. I can click on the column values of work e.g. Manager, the value hardcoded clerk alerts and function 'show it '. I want to show the value of employment, so if I click Manager, the alert must be 'Manager' and if I click on clerk then the alert should be "clerk." I tried to call the function like test(#job#) but no use.

    It does not seem very useful, but all that is needed is to concatenate the value of employment in the event hours code:

    select
      empno,
      ename,
      '' || job || '' as job
    from(
    select 10 empno, 'John' ename, 'Manager' job from dual
    union
    select 20 empno, 'Mark' ename, 'Clerk' job from dual
    )
    
  • By using the link in the column to pass column values

    Hello

    I have a link to the column in my report which opens a modal page, now I want to use the value of the column clicked in the page that opens.

    I don't want to put any article on the opening page of the column value of click rather I want to use the value of the column of the click in my sql query.

    for example:

    1 P1 has the report < column link by clicking on it opens P2 >

    2. on page 2, I want to use the value of the clicked column.

    So far, I did

    1 link to page 2

    2. ask - #column_value_clicked #.

    3. in the sql query, I use the same above in the where clause.

    Any help...

    Thank you

    Rakesh

    fac586 wrote:

    Sunil Bhatia wrote:

    Hi Rakesh,

    Make use of x 01 parameter included in apex 5.0

    You can create a URL to page 1 as:

    f? p = 103:1:3241341234123: & x 01: #column_value_clicked #.

    Make use on request P2 in the form:

    Select * from test_table where id = APEX_APPLICATION. G_X01;

    You have not tested who, did you?

    I tested it buddy.

    Link https://apex.oracle.com/pls/apex/f?p=56971

    Click any bar chart and then wait that he freshen up.

    Click on report of ENAME and see that he went through the parameter.

    Report URL: f? p = 56971:2: & APP_SESSION. : No.: & x 01 = #ENAME #.

    -Sunil Bhatia

  • Put text Logo with SORT column values?

    Hello

    I have a page open IRR w / filters IRR past as follows.

    .. /f?p=200:21:0::no:CIR:IREQ_RELEASE,IREQ_PLATFORM:11.2.0.4,Linux:Yes

    I want to give the page a title with the SORT column values passed as follows.

    "LINUX 11.2.0.4 Report" on the text Logo.

    Is it possible that I can do this? Or if not possible, a way to put it on the field of text or something?

    Hello

    To set the value of your property, you will need to pass something in it:

    https://Apex.Oracle.com/pls/Apex/f?p=9086:2:113599573679605:P2_TITLE:Linux % 20Server % 20Report

    So when I had a session in your application and a value passed to the item value has changed

    I'm not fully grasp what you are trying to reach.  Are you try to click on the pencil edit go to one another form of change in the title of your page will be set to the column name in the report on your previous page?

    You try to dynamically update an element on the page you are on when a filter is added?

    If you can give me more tips, I'm happy to help, if your app is just a demo app on apex.oracle.com and you are happy for me to connect and make changes that might help, I'm happy to do.

    Thank you

    Paul

  • Transpose the unique column values online

    Hi all

    How to transpose the values of one column in a row,

    COL

    1

    2

    3

    4

    5

    6

    7

    8

    and I want to convert this column into the line as follows:

    Line (each in a separate column value). Number of values is not constant.

    1,2,3,4,5,6,7,8

    Solution without converting them to XML:

    WITH row_values

    AS (SELECT DISTINCT property_name,

    column_order

    OF v_rd_property_definition

    WHERE lp_id = 5171

    ORDER BY column_order)

    SELECT Regexp_substr(Wm_concat(property_name), "[^,] +' 1, 1") AS col1,.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 2"). AS col2.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 3") AS col3.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 4") AS col4,.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 5") AS col5,.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 6") AS col6,.

    Regexp_substr (Wm_concat(property_name), "[^,] +' 1, 7") AS col7

    OF row_values;

  • two column values in a single column

    Hi guys,.

    I have a requirement that i want to be viewing the two column values in a single as column... values year & product will be exposed in a unique column values

    Kind regards

    Sree

    Karthickumar Pillaiyarsamy yours is a database, in OBIEE is similar with some limitations...

    Sree! you have 2 ways to do this: by using the CONCAT function or the | operator, examples here are 2 concatenating year, a space and production:

    "Time". "" T05 annually name | ' ' || ' 'Products ' '. Product P1.

    CONCAT ("Time". "T05 per year of name', CONCAT (" ","Products".)" P1 product"))

    CONCAT in OBIEE accept only 2 params, so you if want to add a space between the 2 items, you must nest your function call.

    In case your year column is a number, you can convert it to a string using CAST ("your column" as VARCHAR (10)).

  • How to replace column values

    Hello

    I have the table as below, I need to replace the name column value b with X.how to get it.

    Table

    IDname
    1one
    2b
    3c
    4d
    5e

    Output

    IDname
    1one
    2X
    3c
    4d
    5e

    Hello

    Maybe a little decode?

    select id, decode( name, 'b', 'X', name) from ...
    

    concerning

    Kay

  • A column value a comma, which leads to a column different while export to CSV file

    Hi all

    I have a few columns that will be built in the CSV file. The problem is in one of the column value of a comma in there. Thus, it creates a separate column two in CSv file.

    For example:

    Name of the column: description.

    Value: Bumpers, cushion

    But then that export in CSV file, it gives me bumper as a column and seat cushion in the second column.

    I'm using Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Appreciate your help.

    Thank you

    Suresh

    Hello

    REPLACE (str

    , '"'

    , '"'

    )

    Returns a copy of the string str, but with all the ' "" ' changed substrigs in ' ' ' "

    This assumes that your front-end is not treat & like variable substitution marker.  If it is so, and -is your SQL * more escape character, then you can say

    REPLACE (str

    , '\"'

    , '"'

    )

  • Compare the column values for multiple lines

    I am new to oracle and I have a requirement to compare the values of column across multiple lines.  If all column values are the same, I want to display that value, if the columns are not the same, I need to display 'no match' as value.   I need id to group values and display a status value based on the above logic.   Can anyone offer assistance with dispalying the result expected below?

    Sample

    Table

    State ID

    1         S

    2         L

    1         S

    2          S

    expected results

    State ID

    1         S

    2 no match


    Hello

    That's what you asked for:

    SELECT id

    CASE

    WHEN COUNT (DISTINCT status) > 1

    THEN "no match."

    For ANOTHER MIN (status)

    The END as status

    T

    GROUP BY id

    ;

    Want that if each State ID is NULL?  The CASE expression above returns NULL in this situation.

  • Merge two column in single column value

    Team,

    I have a requirement where in I need to merge 2 column values in a single column.

    e.g. I Percent_complete column in my table. and my table has only one record.

    I need to ask questions that I need to store the values of percent_complete and (100-percent_complete) in a single column.

    ex

    Percentage complete is set to 30.

    I need to select the 30 and 70 (100-30) both in a single column.

    Thank you

    If you mean like this?

    SQL > ed
    A written file afiedt.buf

    1 with t (select 30 as double percent_complete)
    2  --
    3 end of test data
    4  --
    5. Select decode(rownum,1,percent_complete,100-percent_complete) as percent_complete
    6 t
    7 * connect by rownum<=>
    SQL > /.

    PERCENT_COMPLETE
    ----------------
    30
    70

  • How to display the database column value in a component of choice selected?

    Hello everyone;

    I use Jdeveloper 11.1.1.4 and right now I have the .jspx UI page that includes < af:selectonechoice / > components and according to the requirment I have to fill one of the column in the table in this drop-down list.

    can someone tell me how to fill the database column value in this drop-down list. I know I need to create the VO for the same thing, but I'm new to this technology. Then please suggest.

    Thanks in advance.,

    This will help u

    https://blogs.Oracle.com/prajkumar/entry/create_lov_in_adf_application

    How to create LOV in ADF 11 g | Techartifact

    Oracle Fusion Middleware Technologies: 11G: how to create a list of Values (LOV)?

    http://www.baigzeeshan.com/2010/03/creating-lov-in-ADF-application.html

    http://husaindalal.blogspot.de/2010/05/How-to-default-lov-with-its-first-value.html

  • A combine with other values of the column, the column values


    Hi all

    I need your help on this. I have a req I need to combine values of a percentage to the values of column test column. Here are examples of data

    Select decode('test',null,'ABC') abc, b.percent, b.amount

    from tableA, tableB b

    where id = b.id

    Examples of data

    Amount of the percentage TEST

    ABC              0.3                10

    ABC              0.5                20

    ABC              0.2                30

    After him combine the values of percentage to the ABC percentage column values must be zero

    Desired output

    Amount of the percentage TEST

    ABC(30%)                              10

    ABC(50%)                              20

    ABC(20%)                              30

    Valuable suggestions are appreciated

    Alter the query from Etbin with a trifle for the exact release.

    with

    t as

    (select 'ABC' test, 0.3 percent, 10 amount of all the double union

    Select 'ABC', 0.5, 20 double Union all

    Select 'ABC', 0.2, 30 double

    )

    Select test | ' ('| to_char(100 * percent) |'%)' test, null as a percentage, the amount

    t

  • Select the column values in the collection

    Greetings,

    I want to select column values from the collection (plsql tables or table), as the following code, would it be possible
    Here tt is any collection



    Select emp_no, name, date of birth, sal tt (1), tt (2), tt (3), tt (4) emp; -single line query

    Select name, Department of justice, strength and dep_no in tt (5), tt (6), tt (7), tt (8) EMP; -single line query


    Version
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production

    Thanks in advance

    Not sure about your business needs. But technically you can do.

    declare
       type tbl is table of number;
       lemp tbl := tbl();
    begin
       lemp.extend;
       lemp.extend;
       lemp.extend;
    
       select empno
            , mgr
            , sal
         into lemp(1)
            , lemp(2)
            , lemp(3)
         from emp
        where empno = 7369;
    
       for i in 1..lemp.count
       loop
         dbms_output.put_line(to_char(lemp(i)));
      end loop;
    end;   
    

Maybe you are looking for

  • FixIt can not open PDF files

    I can't open PDFs in Firefox - I get a gray screen stating "this plugin is vulnerable and needs to be updated". I go to updates for Fixit and the link takes me to things that I don't understand. I've been using Foxit Reader and this is my default pla

  • graphics upgrade

    I have a HP PAVILLION - p7-1174 and bought a R6670 RADEON graphics card and cannot get the monitor to see. the monitor says scanning then says no signal and goes to sleep. now the integrated graphic card disconnect when I plug the card, but is it pos

  • When I connect to Windows Live Hotmail, I see my emails but cannot access that everything is frozen. A message appears while Live does not and asks me to refresh.

    When I connect to Hotmail, I see my emails but cannot access that everything is frozen. A message then appears that direct does not and asks me to refresh. Windows looking for a solution and after a new wait everything is accessible. Very annoying, h

  • BIOS startup parameter to correct (or unusual) network card?

    Presario F572US Windows 7 64 bit _______________ BIOS / Boot Options / internal network Boot card = ' disabled'. Should it be? BIOS / Boot Options / Boot Order /! Network adapter is 'Enabled'. With the message: "starting capability will be disabled i

  • Upgrade of RAM Kingston DC7900 SFF Compatibiltiy

    I have a DC7900 Small Form Factor with the following specifications: CPU: Intel Core 2 Duo E8500 RAM: 2 GB DDR2 - 6400 800 Mhz Graphics card: integrated Intel GMA 4500 HARD drive: 320 GB + 2 TB SATA2 7200 RPM SATA2 internal ODD: DVD +-R/RW OS: Window