How normalization code in oracle 10 in sql/pl-sql

If any body help manage how the standaridazation code in oracle 10g in sql/pl-sql.

post your coding standards

Tags: Database

Similar Questions

  • How to access Mobile Oracle using PL/SQL Server logs?

    I started using Oracle solutions, so I'm a complete newbie.

    I am doing a project which requires to newspapers to mobile devices using the Oracle Mobile Server (integrated into Oracle Database Lite).
    The mobile server has services that I could use or do I interpret log files?

    Thanks in advance for all support!

    Published by: Hugo Zenha on April 15, 2009 07:40

    Details of base for sync history is MOBILEASDMIN. C$ SYNC_HISTORY. This will give you the id of the customer (name), start and end times, success or failure (and error if failure) as well as the total volume of data uploaded and downloaded.

    You can get more details by joining with c$ sync_his_pub_items on session_id, and this gives details of each downloaded table (phase = UPLOAD) regarding the timings and records and the same for the download. Upload tends to be the complete set of tables (records = 0 for no activity), while the download is only active tables and includes a full refresh occurred

    You can get information for the MGP process via mgp_history c$ and c$ mgp_his_clients

    As all the repository data is stored in the database, there are a lot of possibly interesting things if you look through it.

    We use SQL and PL/SQL to make reports on different users with clocks in a loading time and identification of customers having problems

  • How to count the number of columns in an oracle table using sql

    How to count the number of columns in an oracle table using sql

    You must put the name of the table in capital letters

    As

    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = 'EMP';
    
    or
    
    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = UPPER('Emp');
    

    Concerning
    Arun

  • How to convert the hierarchical query of SQL Server (CTE) to Oracle?

    How to convert the hierarchical query of SQL Server (CTE) to Oracle?

    WITH cte (col1, col2) AS
    (
    SELECT col1, col2
    FROM dbo. [tb1]
    WHERE col1 = 12
    UNION ALL
    SELECT c.col1, c.col2
    FROM dbo. [tb1] AS c INNER JOIN cte AS p ON c.col2 = p.col1
    )
    DELETE one
    FROM dbo. [tb1] AS an INNER JOIN b cte
    ON a.col1 = b.col1

    Hello
    Something like this maybe:

    DELETE FROM dbo.tb1 a
     WHERE EXISTS (
      SELECT 1
        FROM dbo.tb1 b
      WHERE a.co11 = b.col1
          AND a.col2 = b.col2
       START WITH b.col1 = 12
      CONNECT BY b.col2 = PRIOR b.col1)
    

    Although you need to do here is to check that CONNECT it BY SELECT, returns records you wait first, then the DELETION should work too.

  • 65 b error code trying to upgrade Microsoft SQL Server 2005 Express Edition Service Pack 4 (KB2463332)

    65 b error code trying to upgrade Microsoft SQL Server 2005 Express Edition Service Pack 4 (KB2463332)

    Hi Auckland_White,

    ·         Did you the latest changes on the computer?

    ·         You are able to install some other updates on the computer?

    ·         You have security software installed on the computer?

    I suggest you try the steps below and check if it helps

    Method 1: If the problem persists, download and save the installation package' Microsoft SQL Server 2005 Service Pack 4 "on your desktop and try to install the same audit and clean boot.

    See the following article in the Microsoft KB for more information on how to solve a problem by performing a clean boot in Windows Vista or Windows 7:

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: Make sure that return you the computer to a normal startup mode once it's done.

    Microsoft SQL Server 2005 Service Pack 4: http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=b953e84f-9307-405e-bceb-47bd345baece

    Method 2: I suggest that reset you the default Windows Update components and check if you can install the update.

    How to reset the Windows Update components?

    http://support.Microsoft.com/kb/971058

    Hope this information is useful.

  • How to set multiple parameters in a sql EXECUTE IMMEDIATE

    I want to set nls_language and nls_date_language and set them as different languages. fnd_global.set_nls_context () does not work. So I think I can use the EXECUTE IMMEDIATE and add them together into a single statement. But I don't know how to make that happen. Can someone help me? Thank you very much.

    PS: It must be done in a single call.

    928091 wrote:
    Hey, thanks for your reply, I forgot to mention that it should be in the begin-end block, do you know how?

    EXEC is a more SQL API which can be used to execute the PL/SQL code. What it does is put the PL/SQL code in a BEGIN block... END of block and run.

    So, you can also manually put code in a BEGIN block... END of block and run like that.

    SQL> begin
      2     execute immediate q'[begin execute immediate 'alter session set nls_date_language = ''AMERICAN'''; execute immediate 'alter session set nls_language = ''AMERICAN'''; end;]';
      3  end;
      4  /
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    And I don't understand what possible benefit he made a single run in a BEGIN block... Terminate during execution of multiples.

    Why this code is not in your interest, something like this

    begin
         execute immediate 'alter session set nls_date_language = ''AMERICAN''';
         execute immediate 'alter session set nls_language = ''AMERICAN''';
    end;
    /
    
  • How to avoid performance issues in PL/SQL?

    How to avoid performance issues in PL/SQL?

    According to my knowledge, below a few points to avoid performance problems in PL/SQL.
    Is there any other point to avoid performance problems?

    1. use FORALL instead of the FORUM and GATHER in BULK to avoid a loop several times.
    2. RUN IMMEDIATE is faster than DBMS_SQL
    3. use NOCOPY for OUT and IN OUT if the original value need not be retained. Overhead of keeping a copy of OUT is avoided.

    Thanks for your comments Justin!

    BC explains things right on part SQL...

    http://www.DBA-Oracle.com/art_sql_tune.htm

  • How do 3 similar fun generate different sql string in the call of 1 db

    Hi all
    In my sql package I use 3 different functions to create two different sql strings and the 3rd function does some calculations of percentage. My Db architect on the revision of the code suggest to me that these two functions are almost the same except the sql string, it generates. Then she asked me to write a function that does everything in a db call.

    "_Function 1_ '.

    FUNCTION get_class_select_text
    (
    in_report_parameter_id in NUMBERS
    )
    RETURN VARCHAR2
    IS

    my_class_select_text VARCHAR2 (10000);
    my_class_select_value VARCHAR2 (10000);

    CURSOR class_select_text IS
    SELECT ' SUM (DECODE (bin_id, ' | report_parameters.report_parameter_value))
    || bin_value, 0)) ' Class' | report_parameters.report_parameter_value | '" '
    OF report_parameters
    WHERE report_parameters.report_parameter_id = in_report_parameter_id
    AND report_parameters.report_parameter_group = 'CLASS '.
    AND report_parameters.report_parameter_name = 'CLASS '.
    GROUP BY
    report_parameters.report_parameter_value
    ORDER BY
    CAST (report_parameters.report_parameter_value AS NUMBER);

    BEGIN

    my_class_select_text: = ";

    OPEN class_select_text.

    LOOP

    SEEK class_select_text INTO my_class_select_value;

    EXIT WHEN class_select_text % NOTFOUND;

    my_class_select_text: = my_class_select_text | ', ' || my_class_select_value;

    END LOOP;

    CLOSE Class_select_text;

    RETURN my_class_select_text;

    END get_class_select_text;

    FUNCTION 2:


    FUNCTION get_class_sum_text
    (
    in_report_parameter_id in NUMBERS
    )
    RETURN VARCHAR2
    IS

    my_class_sum_text VARCHAR2 (10000);
    my_class_sum_value VARCHAR2 (10000);

    CURSOR class_sum_text IS
    SELECT ' SUM (NVL ("Class' |")) report_parameters.report_parameter_value | ""(, 0)) ' class' | "" report_parameters.report_parameter_value | '" '
    OF report_parameters
    WHERE report_parameters.report_parameter_id = in_report_parameter_id
    AND report_parameters.report_parameter_group = 'CLASS '.
    AND report_parameters.report_parameter_name = 'CLASS '.
    GROUP BY
    report_parameters.report_parameter_value
    ORDER BY
    CAST (report_parameters.report_parameter_value AS NUMBER);

    BEGIN

    my_class_sum_text: = ";

    OPEN class_sum_text.

    LOOP

    SEEK class_sum_text INTO my_class_sum_value;

    EXIT WHEN class_sum_text % NOTFOUND;

    my_class_sum_text: = my_class_sum_text | ', ' || my_class_sum_value;

    END LOOP;

    CLOSE Class_sum_text;

    RETURN my_class_sum_text;

    END get_class_sum_text;

    FEATURE 3:


    FUNCTION get_class_perc_text
    (
    in_report_parameter_id in NUMBERS
    )
    RETURN VARCHAR2
    IS

    my_class_perc_text VARCHAR2 (10000);
    my_class_perc_value VARCHAR2 (10000);

    CURSOR class_perc_text IS
    SELECT ' ROUND ((("Class' ||)) report_parameters.report_parameter_value | "' / 'Total') (* 100)(, 2) ' class |" " report_parameters.report_parameter_value | '" '
    OF report_parameters
    WHERE report_parameters.report_parameter_id = in_report_parameter_id
    AND report_parameters.report_parameter_group = 'CLASS '.
    AND report_parameters.report_parameter_name = 'CLASS '.
    GROUP BY
    report_parameters.report_parameter_value
    ORDER BY
    CAST (report_parameters.report_parameter_value AS NUMBER);

    BEGIN

    my_class_perc_text: = ";

    OPEN class_perc_text.

    LOOP

    SEEK class_perc_text INTO my_class_perc_value;

    EXIT WHEN class_perc_text % NOTFOUND;

    my_class_perc_text: = my_class_perc_text | ', ' || my_class_perc_value;

    END LOOP;

    CLOSE Class_perc_text;

    my_class_perc_text: = my_class_perc_text | ', ' || ' DECODE 'Total' ('Total', -1, 0, 100) ';

    RETURN my_class_perc_text;

    END get_class_perc_text;


    Could someone help me?

    Thanks in advance.

    Hello
    Never write, not to mention NPA, not formatted.
    Use the spaces so that how the code appears on the screen reflects what it does.
    In particular, to align the bunk directly following each other.
    (a) IS, BEGIN, EXCEPTION and END statements
    (2) the instructions of LOOP and END LOOP
    (3) provisions (SELECT, FROM, WHERE,...) in SQL statements
    (4) number of arguments for the same function (unless they are very simple)
    When displaying a kind of formatting text on this site, type the 6 characters:
    {code}
    (small letters only, inside curly braces) before and after the formatted text, to maintain spacing.

    user10641405 wrote:
    Hi all
    In my sql package I use 3 different functions to create two different sql strings and the 3rd function does some calculations of percentage. My Db architect on the revision of the code suggest to me that these two functions are almost the same except the sql string, it generates. Then she asked me to write a function that does everything in a db call.

    Looks like you are using 3 different functions to create 3 different channels.
    All 3 functions return the results of a query that has a column, a string that is made by concatenating strings under 5.
    It looks like the only differences between the 3 functions are:
    (a) the chains under 1st and 3rd in the concatenation are different in each case
    (b) of the function, we add additional text at the end of the query results

    Here's a way to combine these functions, so that you call
    get_class_text (x, "SELECT") instead of get_class_select_text (x),
    get_class_text (x, "SUM") instead of get_class_sum_text (x), and
    get_class_text (x, "PERC") instead of get_class_perc_text (x).

    FUNCTION get_class_text
    (
         in_report_parameter_id IN NUMBER
         in_which            IN VARCHAR2 DEFAULT 'SELECT'
    )
    RETURN VARCHAR2
    IS
         end_text        VARCHAR2 (50)   := '';
    
         my_class_perc_text VARCHAR2(10000) := '';
    
         CURSOR class_perc_text ( c_1_text     VARCHAR2 (50)
                                 , c_2_text     VARCHAR2 (50)
                          )
         IS     SELECT  c_1_text || report_parameters.report_parameter_value
                               || c_3_text
                               || report_parameters.report_parameter_value
                               || '" '
         FROM    report_parameters
         WHERE     report_parameters.report_parameter_id     = in_report_parameter_id
         AND     report_parameters.report_parameter_group  = 'CLASS'
         AND     report_parameters.report_parameter_name   = 'CLASS'
         GROUP BY
                 report_parameters.report_parameter_value
         ORDER BY
                 CAST(report_parameters.report_parameter_value AS NUMBER);
    BEGIN
         IF  UPPER (in_which) = 'SUM'
         THEN
              OPEN class_perc_text ( 'SUM(NVL("Class '
                                  , '", 0)) "Class '
                             );
         ELSIF  UPPER (in_which) = 'PERC'
              OPEN class_perc_text ( 'ROUND((("Class '
                                  , '" / "Total") * 100), 2) "Class '
                             );
              end_text := ', DECODE("Total", -1, 0, 100) "Total" ';
         ELSE
              OPEN class_perc_text ( 'SUM(DECODE(bin_id, '
                                  , ', bin_value, 0)) "Class '
                             );
         END IF;
    
         LOOP
              FETCH class_perc_text INTO my_class_perc_value;
              EXIT WHEN class_perc_text%NOTFOUND;
    
              my_class_perc_text := my_class_perc_text || ', ' || my_class_perc_value;
         END LOOP;
    
         CLOSE class_perc_text;
         my_class_perc_text := my_class_perc_text || end_text;
    
         RETURN my_class_perc_text;
    END get_class_text;
    

    Note how you can have settings for a cursor, so that certain expressions used in the cursor must not be known when the cursor is declared: they can be given when the cursor is opened.

  • How to divide a collection of PL/SQL in two?

    Hello

    I try to divide a pl/sql table into two, but ended up with some "nasty" loops

    I was wondering if there was an easier way?
    Session altered.
    SQL> create or replace package my_package
    as
       function my_func(required_number_of_elements in number) 
         return sys.odcinumberlist;
    end my_package;
    Package created.
    SQL> create or replace package body my_package
    as
          
       function my_func(required_number_of_elements in number) 
         return sys.odcinumberlist
       is
          return_list sys.odcinumberlist;
          log_list    sys.odcinumberlist := sys.odcinumberlist();
          
          procedure split_it
          is
    -- Should split list, so 
    --   log_list holds return_list(required_number_of_elements + 1) .. return_list(return_list.count) 
    --   return_list holds return_list(1) .. return_list(required_number_of_elements)           
          begin
             IF required_number_of_elements < return_list.count
             THEN
                log_list.extend(return_list.count - required_number_of_elements);
    
                FOR i IN  required_number_of_elements + 1 .. return_list.count
                LOOP
                  log_list(i - required_number_of_elements) := return_list(i); 
                END LOOP;
                
                return_list.trim(return_list.count - required_number_of_elements);
                
             END IF;
          end split_it;
       begin
    
          select object_id
          bulk collect into return_list
          from all_objects
          where rownum <= 5; -- Disregard, just to simplify example
          
          split_it; -- How to write this?
    
          dbms_output.put_line('return_list.count: ' || return_list.count);
          dbms_output.put_line('log_list.count: ' || log_list.count);            
          return return_list;
       end my_func;
    end my_package;
    Package body created.
    SQL> declare 
      dummy sys.odcinumberlist;
    begin 
      dummy := my_package.my_func(3);
      dummy := my_package.my_func(10);
    end;
    return_list.count: 3
    log_list.count: 2
    return_list.count: 5
    log_list.count: 0
    PL/SQL procedure successfully completed.
    BANNER                                                          
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    1 row selected.
    Concerning
    Peter

    Published by: Peter on May 13, 2009 02:01
    Banner added

    How to divide a collection of PL/SQL in two?

    Just copy and DELETE the part of the original Collection:

    SQL> declare
       c1 sys.dbms_debug_vc2coll;
       c2 sys.dbms_debug_vc2coll;
    begin
       select to_char (level)
       bulk collect
       into c1
       from dual
       connect by level <= 10;
    
       c2 := c1;
       c1.delete (1, 5);
       c2.delete (6, 10);
    
       for i in c1.first .. c1.last
       loop
          dbms_output.put_line ('C1: ' || c1 (i));
       end loop;
    
       for i in c2.first .. c2.last
       loop
          dbms_output.put_line ('C2: ' || c2 (i));
       end loop;
    end;
    /
    C1: 6
    C1: 7
    C1: 8
    C1: 9
    C1: 10
    C2: 1
    C2: 2
    C2: 3
    C2: 4
    C2: 5
    PL/SQL procedure successfully completed.
    
  • How to place a collar from pl/sql tab to set cursor?

    Hello
    I constantly get this error:
    **************************************
    Error on line 1
    declare
    --------------------------------------------
    number of j: = 1;

    cursor f

    ORA-06550: line 9, column 20:
    PLS-00103: encountered the symbol "TABLE" when the expected in the following way:

    constant exception < an ID >
    < a between double quote delimited identifiers > double Ref table Fedya
    char time timestamp interval date binary national character
    NCHAR
    *************************************************
    Code snippet:


    declare
    --------------------------------------------
    number of j: = 1;

    cursor firstquery (c_item in varchar2) is
    SELECT SEARCH, the NAME, ID OF tablename
    WHERE name LIKE c_item.

    first_rec_tbl_type is the firstquery % rowtype directory index table;
    first_rec_tbl first_rec_tbl_type;

    type act_str_tbl_type is table of the varchar2 (50) index directory.
    act_put_str_tbl act_str_tbl_type;

    Start

    It's the fine workmanship that I performed as a stand-alone script also

    a table of act_put_str_tbl here.passing of values to below:

    -I guess the problem lies here-
    Start

    dbms_output.put_line (' second reached start ');
    I'm in act_put_str_tbl.first... act_put_str_tbl. Last
    loop
    dbms_output.put_line (' inside the second loop start ');
    Open firstquery (act_put_str_tbl (i));
    loop
    extract the firstquery in first_rec_tbl (j);
    j: = j + 1;
    released in firstquery % notfound or firstquery is null;
    end loop;
    close firstquery;
    end loop;


    How to use parameterized cursor with PL/SQL table, any help is appreciated in the snippet above.

    Thank you

    user540130 wrote:
    In the two above you are beating the objective by the way
    Open firstquery ('S%'); Why you can not spend the type of array here is also of type varchar.

    Oops. Check my edited answer now.

    SY.

  • SWIFT playgrounds, how to Code 2, build a loop, I can not find isOnGem

    Swift playgrounds, how to Code 2, build a loop, I can not all isOnGem. What Miss me? If I am not mistaken, is it a bug? How should I declare?

    I can't figure out how to solve the puzzle without this.

    isOnGem is not available as an option in the box to scroll so just type in from the table instead. If you enter exactly the same case, it will be recognized as legal code when you run your program.

  • How to code a batch file to put in the form of z: drive?

    I would like to drive Z: quick format and xcopy in D: drive in the Z: drive for backup.

    I would like to pass on any message entry also.

    Anyone have any suggestions on how to code a batch file for this?

    Thanks for all the suggestions

    Hi oem7110,

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is best suited for on TechNet. Please post your question in the TechNet forum. Link: http://social.technet.microsoft.com/Forums/en-US/ITCG/threads

    With regard to:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Need to find a way to understand how DB2 connect to Oracle and mirroring of data etc.

    Hi, gurus,

    I just take over a source project which is the ICOMS as400 db2 database. Seems data mirro that CDC is used to replicate from DB2 to oracle.

    I am very new to this CDC datamirror, more I am new to figure out how db2 connect to oracle, it is only through db link or what? or is it tnsnames entry?

    I wish someone in this forum can point me in the right direction.

    Thanks in advance.

    Hello

    What do you not sure about?
    If Oracle can be the site of conduct, you can use the gateway for DRDA database and we can help you with that. If you need assistance on setting up DataMirror CDC to connect to Oracle, then you will need to contact IBM because it is one of their products.

    Kind regards

    Mike

  • How to code a default widget - FORMS in Adobe Muse

    How the code of the widget by default FORMS in Adobe Muse? Please write the code of the widget.

    Thank you!

    Hi Tony,.

    Widgets by default, including the form, are native widgets of Muse which have different features than MuCOWs. Currently, it is not possible to create something that mimics the behaviour of widget native Muse, just what is shown in the MuCOW feature.

    Hope that clarifies things,

    Andrew

  • Difference between Oracle database and SQL or SQL Developer +?

    Hello
    I am very very new to Oracle... Only yesterday I installed Oracle 11 G for learing... I found to create an Oracle database

    Oracle Db11gHome1 = > Configuration and Migration Tools = > Database Configuration Wizard
    ... blah... blah... blah... Success... I created...

    But I found the menus

    Oracle Db11gHome1 = > application development = > SQL Developer
    Oracle Db11gHome1 = > = application development > SQL Plus

    And so I get confused... I know SQLSERVER 2008... etc... to create databases... So the above said two is for what purpose?
    Anyone can show me a route for this spirit of quarrels?

    Thank you

    Hello

    Welcome to the world of Oracle.

    SQL Developer: http://www.oracle.com/technetwork/developer-tools/sql-developer/what-is-sqldev-093866.html

    SQl more: http://docs.oracle.com/cd/B13789_01/server.101/b12170/qstart.htm

    These docs will give an initial advance for these tools.

    Something in common between these two tools is: both are used to access the Oracle database.

    Thank you
    Navneet

Maybe you are looking for