Need PlSQL code to find out the column/combination of columns from a given table which will be unique values

Given a table with some columns and data associated with that. Need to find out a column or a combination of some columns, so that the values or combination of values will be unique in the table.
The table and number of columns and the columns will be dynamic.
Can you please help me with the solution?

f8d0dcea-cdf0-4935-8734-632fe021456c wrote:
No key is defined in the table.
Suppose a table contains 20 columns then I need the unique combinations of all columns.
Example: A table 'Employee' has 4 columns: Emp_No, Emp_Name,Passport_No,Emp_Designation. No key is defined for Employee table. Need to find out which column(single column and combination if columns) have unique values. Like, First check if Emp_No is unique then check Emp_No+Emp_Name is unique, then check if Emp_No+Emp_Name+Passport_No is unique, then check Emp_No+Emp_Name+Passport_No+Emp_Designation is unique.
Then again try with the combination of Emp_No+Passport_No and so on. In this way I need to find out all the combinations having unique values.
As Paul says, that will be a waste of time, as it will taken a lot of processing for all the possibilities, checking all the data each time to determine which combinations of columns provide uniqueness.  What happens if someone inserts or deletes some data whilst your doing it?
You'd be quicker to manually look at the tables, and make an educated guess and then test for uniqueness with a quick query on that guess.

Similar Messages

  • Code to find out the mobile number of a nokia set

    Can any one tell me what is the code to find out the mobile number of a nokia handset.

    @pabitra
    There is no reliable way from/with the phone to find out your own number that works with all phones, all operators/networks, all SIM cards unfortunately.
    Simplest way maybe to dial a landline with caller id. or another mobile.
    Happy to have helped forum with a Support Ratio = 42.5

  • How to find out the plants and storage location for a given company code

    hi
    How to find out the plants and storage location for a given company code

    Hi
    Check for Assignem,ent of Plant & compnay code in OX18
    & for Combination of Plant & Storage location in OX09
    The total org structure can be viewed in EC01 - Click on Structure  -> navigation
    & Continue, Click on the Compnay code & the wole structure can be viewed
    Thanks & Regards
    Kishore

  • Is there any way to find out the dependency information for column of view?

    Does Oracle provide some view / table / pl/sql pkgs to find out the dependency information for column of view ?
    For example, there are two table mytable1 (col1 varchar2(10), col2 date) & mytable2 (col1 varchar2(10), qty int), and there is one view myView as
    select mytable1.col1, col2, qty from mytable1 inner join mytable2 on mytable1.col1 = mytable2.col
    Can I get some information such as myView.col1 is come from mytable1.col, myView.col2 is come from mytable1.col2, myView.qty is come from mytable2.qty
    ?

    I can get the information about the columns list in table/view from ALL_TAB_COLUMNS table, but I wish to know the column in the view is come from which original table's column.
    Is there any way to find it out from Oracle meta data / through any PL/SQL packages ?

  • I am working in Adobe Acrobat 9 Pro and just created a pdf form from a MS Word document. I need to find out how to have a date field in my form which will update automatically. Can some one out there help me?

    I am working in Adobe Acrobat 9 Pro and just created a pdf form from a MS Word document. I need to find out how to have a date field in my form which will update automatically.

    Update automatically under which circumstances, exactly?

  • I have lost my Iphone and never activated my Icloud on my phone.  Is there anyway of locating it whereabouts???  Also Who ever has my phone has downloaded find my phone.  Is there anyway Apple can find out the address that was downloaded from??

    I have lost my Iphone and never activated my Icloud on my phone.  Is there anyway of locating it whereabouts???  Also Who ever has my phone has downloaded find my phone.  Is there anyway Apple can find out the address that was downloaded from??

    Unfortuantely, you can only track the phone if you had set up iCloud and enabled Find My iPhone on it before it was lost or stolen.  I don't believe there is anything that Apple can do to locate your phone either.

  • Wat is the Transaction Code to find out the Pending Training List

    Hello Gurus,
    Please let me know the Transaction Code how to find out the pending training list in Training Module in SAP-HR.
    Kindly give me the Transaction Code or the report name.
    Regards
    AM.

    Hi,
    What do you mean by pending traing list.
    Regards,
    Kapil Kaushal

  • How to find out the date of license conversion (from Standard to Datacenter)?

    I had problems with Microsoft licensing and i need to find out, when my servers was converted from Standard to be Datacenter ?
    All my servers was standard, now it's Datacenter and i need to know from when it's Datacenter ???

    What I really mean is that I have EA with Microsoft and I'm eligible for example 10 Standard and 5 Datacenter.
    During Microsoft auditing they found that I have installed 10 Datacenter and 5 Standard, which is not original design, so obviously someone from my team converted 5 servers from Standard to Datacenter.
    My question here that I need to know when exactly my servers where converted, so I can know who converted it as this mistake costs my company a lot!
    I need to know time and data when my server was converted from Standard to Datacenter edition? May be it's recorded in registry or somewhere i can find using PowerShell or something, the same Idea of finding out Installation date using this command:
    "([WMI]'').ConvertToDateTime((Get-WmiObjectWin32_OperatingSystem).InstallDate)"
    Ah, that helps me understand, thanks.
    If you installed Standard, and then used DISM /Online /Set-Edition.....
    http://technet.microsoft.com/en-us/library/jj574204.aspx
    this should be logged in the DISM logfile: %windir%\Logs\DISM
    https://technet.microsoft.com/en-us/library/ee851579(v=ws.10).aspx
    You may also find some details in the Windows event logs (if you still have that history available).
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • To find out the history of alerts generated from repository .

    Hi,
    I have my grid control repository database with following details:
    Version:- Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
    OS:- AIX
    How can I find out the alerts generated in the past. For example, currently i need following two informations :
    1. How many critical alerts where generated related to temp tablespace in last three months and for which database ?
    2. During a os patching activity, it was found that targets where not blacked out properly. How do we find that what where the targets that were not balcked out properly ?
    Is there any way to find the above two information from the repository database?
    Regards
    Vinita

    I think you might have the wrong forum.

  • Plsql query to find out the concurrent programs attaching a plsql package

    I want to find all the concurrent programs attaching a particular package. Please provide me with the appropriate query to get that.

    Hello,
    1- First thing: we are talking about a SQL query (and not a PL/SQL query).
    2- I would like to add an additional filter to the query of shazi as the query should show only PL/SQL packages
    SELECT
    fcp.CONCURRENT_PROGRAM_ID
    ,fcp.concurrent_program_name
    , fcpt.user_concurrent_program_name
    , DECODE(fe.execution_method_code
    , 'I', 'PL/SQL'
    ,'P', 'Reports'
    ,'C', 'SQL Loader'
    ,'Q', 'SQL Plus'
    ,'K', 'Java'
    ,'H', 'OS executable'
    ,'B' , 'Req. Set Stage'
    ) EXECUTION_METHOD
    ,UPPER(EXECUTION_FILE_NAME) PACKAGE_BODY
    from
    fnd_concurrent_programs_tl fcpt
    , fnd_executables fe
    ,fnd_concurrent_programs fcp
    where 1=1
    --and fcpt.concurrent_program_id = fcr.concurrent_program_id
    and fe.executable_id = fcp.executable_id
    and fcpt.concurrent_program_id = fcp.concurrent_program_id
    and fe.execution_method_code = 'I' /* here's the additional filter */
    --and fcpt.user_concurrent_program_name = :P_USER_CONC_PROGRAM_NAME
    --fcp.concurrent_program_name = :P_CONC_PROGRAM_NAME /* using this filter would use an index */
    Lalaina

  • Find out the users who are performing operation on a table - point of time

    Can anyone help me to find out who is performing a table level operation on some table at a time. For ex., table "emp" at a point of time who are all the users connected and accessing this table as i am getting a "resource busy" when i try to drop an index.
    Regards,
    G.Santhoshkumar.

    You could try something like the following :
    SYS@db102 SQL> select username, sid, serial#
      2  from v$session s, v$locked_object l, dba_objects o
      3  where s.sid = l.session_id
      4  and l.object_id = o.object_id
      5  and object_name = 'EMP';

  • Need a Script to find out the Grayed out agents in SCOM 2012

    Hi,
    I am trying to create a Dashboard view to list the Grayed Out servers in my SCOM 2012 environment by using the script below but it does not work as expected.
    Is there something wrong with this script or could you suggest me any other solution please?
    #Get all agent objects which are not available (grey)
    $agentclass = Get-SCOMClass -Name "Microsoft.SystemCenter.Agent"
    $agentobjects = Get-SCOMMonitoringObject -Class:$agentclass | Where-Object {$_.IsAvailable -eq $false}
       foreach ($agent in $agentobjects)
        $dataObject = $ScriptContext.CreateFromObject($agent, "Id=Id,State=HealthState,Display Name=DisplayName", $null)
        #Get the watcher state for the agent
        $watcher = Get-SCOMClass -name "Microsoft.SystemCenter.HealthServiceWatcher"| get-scomclassinstance |  Where-Object {$_.Displayname -eq $agent.DisplayName}
        $dataObject["Watcher State"] = $watcher.HealthState.toString()
        $ScriptContext.ReturnCollection.Add($dataObject)
    Thanks
    Srini

    Try some of these:
    Stefan
    Maurice
    Similar
    Topic
    Regards, Blake Email: mengotto<at>hotmail.com Blog: http://discussitnow.wordpress.com/ If my response was helpful, please mark it as so, if it answered your question, then please also mark it accordingly. Thank you.

  • How can i find out the color of ipod nano from serial number

    apple is shiping my new nano that has been replaced from 1st gen. nano  How can I determine the color from the serial number as I need to order the watchband asap.  thanks in advance

    So far all 6g replacments appear to be silver I have not heard any exceptions. Do not know if you can work out colour from serial

  • When I receive an SMS message, how do I find out the phone number it came from?

    When I receive an SMS message from a person in my address book, the Messages app in my iPhone shows the name of the person who sent the message.  At the top of the conversation, I can tap the word "Contact", which brings up the Contact's name, a phone icon, a camera icon, and a letter i in a circle.  If I tap the i, it brings up the sender's record from my address book.  How do I know which of the sender's multiple phone numbers is the number that he sent the message from?

  • Query to find out the Activities done against a table

    Hi,
    One table has been truncated and data reloaded into the table by the user. But at latter stage user deny that activity. I believe all these activities stored in any oracle 10g database table.
    Need a query to find out the activities done on a specific date say 6th Sep.
    This is too urgent. Thanks in advance

    Hi,
    Welcome to the forum!
    If you don't have enable table auditing maybe you can see last_ddl_time column of user_objects view:
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL> select * from test2;
          COL1       COL2       COL3
             1          1          3
             1          2          3
             1          3          3
    SQL> select to_char(uo.created, 'DD/MM/YYYY HH24:MI:SS'), to_char(uo.last_ddl_time, 'DD/MM/YYYY HH24:MI:SS') from user_objects uo where uo.object_name = 'TEST2';
    TO_CHAR(UO.CREATED,'DD/MM/YYYY TO_CHAR(UO.LAST_DDL_TIME,'DD/M
    12/09/2009 12:20:26            12/09/2009 12:20:27
    SQL> truncate table test2;
    Table truncated
    SQL> select to_char(uo.created, 'DD/MM/YYYY HH24:MI:SS'), to_char(uo.last_ddl_time, 'DD/MM/YYYY HH24:MI:SS') from user_objects uo where uo.object_name = 'TEST2';
    TO_CHAR(UO.CREATED,'DD/MM/YYYY TO_CHAR(UO.LAST_DDL_TIME,'DD/M
    12/09/2009 12:20:26            12/09/2009 14:01:21
    SQL> Regards,

Maybe you are looking for

  • How can I convert an email  in a PDF document?

    iOS How can I convert an email  in a PDF document?

  • In PS module transaction CJ40 after detail planning back button throws out

    In CJ40 primary cost planning we come back to annual view by clicking back button now if i press back button system throws out from transaction CJ40 . rather to come back to element overview screen. Anybody can give me solution for this as the user s

  • Label each point in scatter plot

    Hi There, I am plotting a set of data (in x,y format) on a scatter plot. Is there a way in labview such that when i move mouse over some dot it can tell me information about that dot (like the name of that set). Thanks in advance Yogesh  PS: i am usi

  • Dedicated SolMan required for ...?

    Hi, i have a question which i was not able to answer by reading guides or searching in the sdn, so maybe there is not such a question in this forum already or i am blind. My question is: As it is finally possible to use a SolMan for totally different

  • Can not use Minisap 4.6 R/3

    I have followed all the instructions in the book. For some reason, when I start the object navigator, instead of the object navigator, I see a 'Page not found' instead of the object list. Please, why is this? I have even installed the patch. Thanks.