How to create a pl/sql function to give the sum of 100 not

Hai
If it is possible to create a function to find a sum of the first 100 numbers

Concerning
Srikkanth.M

You needn't PL/SQL for this:

SQL> select sum(level) sum_100 from dual connect by level <= 100
  2  /

   SUM_100
----------
      5050

SQL> 

SY.

Tags: Database

Similar Questions

  • How to create a user-defined function?

    is there a substitute for the exe instsrv and srvany in Vista?

    I don't know what means your post, so here's how to create a user-defined function:
    1) click Start
    (2) select "Control Panel".
    (3) select "system and maintenance".
    4) click on "Administrative Tools".
    5) click on "Task Scheduler."
    (6) click on "create task" (right in the list pane under) "Actions") "
    "(7) opened in the general tab it will choose if it only works when the account that is used to implement is connected, or ' if that user is logged in or not" (leave the box ' do not store the... "empty password)
    (8) always in the general tab, check the box 'run with highest privileges '. (This will ensure that no program can block)
    (9) type a name for the task (in the general tab)
    (10) to set the job to run an awhile, use the "triggers" tab, if you want to set a task runs after xx min. temps_inactivite, choose the 'conditions' tab, then choose the desired time.
    (12) click on the 'actions' tab click on 'new '. in the program/script line, search for and select the program you want to run, and then click Open.
    13) click OK in the window "create a task".
    14) click OK again and you are done.
    I hope this helps.

  • How to get the query of the region "PL/SQL function body returns the query string"?

    Hello

    is it possible to get the query string from the region of type "PL/SQL function body returns the query string"?

    I can get the definition of the region as a PL/SQL procedure, but I am interested in the returned query. I tried to write something like

    < pre > v_return_query: = «...» » ;
    : P49_QUERY: = v_return_query;
    Return v_return_query; < / pre >

    to save the return on hidden item P49_QUERY string, but it does not work. I get the error message: ERR-1002 cannot find the item for the "P49_QUERY" element ID in the application '4000 '.

    Kind regards
    Przemek

    If you need to make reference to a page element in the block then you can use this type of control to avoid having to use generic column names:

    if apex_application.get_current_flow_sgid(:APP_ID) = apex_application.get_sgid then-- runtime  :P9_SQL := vSQL;else-- design time  null;end if;
    

    But if all you want to do is capture the SQL debugging you can take all the references element in the block and use the insert statement (in a debug table) as I showed earlier.

    Scott

  • How to create a button to download files in the form?

    How to create a button to download files in the form?

    Hello

    Please refer to the link below with a similar discussion.

    Download file button

    Kind regards

    Vivek

  • Am about to buy DW.  2 quick questions before proceeding.  (1) can I associate a DW created an EXTERNAL SQL Express database for the read/write site?  Can be made safe?  (2) am plans to use Contribute to allow non-technical users to end dry change

    Am about to buy DW.  2 quick questions before proceeding.  (1) can I associate a DW created an EXTERNAL SQL Express database for the read/write site?  Can be made safe?  (2) am plans to use Contribute to allow non-technical end users EASILY change the sections of the web site.  Can this work?  Thank you.

    I would like some ideas.

    A CMS is the standard solution in the industry today. The most common environment is LAMP (LINUX, Apache, MySQL, PHP).

    Some of us to write custom CMS systems for a living. I concentrate on CMS for retirement centers. There are all kinds of solutions CMS available ranging from generalist, off-the-shelf CMS like WordPress, completely custom, with a lot of opportunities in the meantime.

  • SQL query to display the sum of the values of each June and December

    Hello having problems of construction of a query to the list SQL query to display the sum of the values of each June and December each year.

    My Table;

    TABLE name: MONTH_TERM

    Fields with values:

    TERM_KEYMONTH_ACTUALMONTH_DATE
    8250001/11/2015 0:00
    8245001/12/2015 0:00
    8240501/01/2016 0:00
    8240001/02/2016 0:00
    8245001/03/2016 0:00
    8242501/04/2016 0:00
    8243501/05/2016 0:00
    8241006/01/2016 0:00
    8240901/07/2016 0:00
    8241501/08/2016 0:00
    8242009/01/2016 0:00
    8242210/01/2016 0:00
    8243611/01/2016 0:00
    8255601/12/2016 0:00
    8256801/01/2017 0:00
    8262402/01/2017 0:00

    What I would like to see in a query result:

    TERM_KEYMONTH_ACTUALMONTH_DATETotal of 6 months
    8250001/11/2015 0:00
    8245001/12/2015 0:00950
    8240501/01/2016 0:00
    8240001/02/2016 0:00
    8245001/03/2016 0:00
    8242501/04/2016 0:00
    8243501/05/2016 0:00
    8241006/01/2016 0:002525
    8240901/07/2016 0:00
    8241501/08/2016 0:00
    8242009/01/2016 0:00
    8242210/01/2016 0:00
    8243611/01/2016 0:00
    8255601/12/2016 0:002658
    8256801/01/2017 0:00
    8262402/01/2017 0:00

    ---

    Here's my query:

    Select

    "TERM_KEY,"

    "MONTH_ACTUAL,"

    to_char(MONTH_DATE,'MM/YYYY') MONTH_DATE,

    DEAL to_char (MONTH_DATE, 'MM')

    WHEN '06' THEN (SELECT SUM (MONTH_ACTUAL)

    OF MONTH_TERM

    WHERE the to_char (MONTH_DATE, 'MM') between 1 and 6

    AND term_key = 82)

    WHEN '12' THEN (SELECT SUM (MONTH_ACTUAL)

    OF MONTH_TERM

    WHERE the to_char (MONTH_DATE, 'MM') between 7 and 12

    AND term_key = 82)

    ELSE null

    END as SIX_MO_CUMM,

    of MONTH_TERM

    where term_key = 82

    It's my results:

    TERM_KEYMONTH_ACTUALMONTH_DATETotal of 6 months
    8250001/11/15 0:00
    8245001/12/15 0:003608
    8240501/01/16 0:00
    8240001/02/16 0:00
    8245001/03/16 0:00
    8242501/04/16 0:00
    8243501/05/16 0:00
    8241001/06/16 0:003717
    8240901/07/16 0:00
    8241501/08/16 0:00
    8242001/09/16 0:00
    8242210/01/16 0:00
    8243601/11/16 0:00
    8255601/12/16 0:003608
    8256801/01/17 0:00
    8262401/02/17 0:00

    Any ideas on how to fix would be great

    Select term_key,

    month_actual,

    month_date,

    case mod (to_char (month_date, 'mm'), 6)

    When 0 then sum (month_actual)

    During)

    term_key partition

    order of month_date

    between the previous month '5' interval and the current line

    )

    end '6 MONTHS in TOTAL'

    from tbl

    order of term_key,

    month_date

    /

    TERM_KEY MONTH_ACTUAL MONTH_DAT 6 MONTHS TOTAL
    ---------- ------------ --------- --------------
    82 500 NOVEMBER 1ST, 15TH
    82 450 1 DECEMBER 15 950
    82 405 1 JANUARY 16
    82 400 1 FEBRUARY 16
    82 450 1ST MARCH 16
    82 425 1ST APRIL 16
    82 435 1 MAY 16
    82 410 2525 1 JUNE 16
    82 409 1 JULY 16
    82 415 1ST AUGUST 16
    82 420 16 - SEP - 01

    TERM_KEY MONTH_ACTUAL MONTH_DAT 6 MONTHS TOTAL
    ---------- ------------ --------- --------------
    82 422 1 OCTOBER 16
    82-436 NOVEMBER 1, 16
    82 556 2658 1 DECEMBER 16
    82 568 1 JANUARY 17
    82 624 1 FEBRUARY 17

    16 selected lines.

    SQL >

    SY.

  • How can I remove an account from activation if the former owner is not found?

    How can I remove an account from activation if the former owner is not found?

    Unless it's yours, you can't, and Apple will be not remove for you. Locking activation is a measure of protection against theft.

    (141565)

  • How to create an identifier SQL, sql Profiler

    Hi team,

    An application runs for a long time if I want to create the sql for If sql Profiler for the request. Example is my sql f70m2g5rbfvbg code.

    My question is how to create the sql for the best recommendation Profiler and how to import the sql for acccepting Profiler the best profile for improved performance.

    Please suggest

    Hello

    1. you must accept the best plan based on the recommendations of the Advisor tuning

    2. second thing is to import the profile sql - transport to destination db (where you want to import)

    -Pavan Kumar N

  • How to create a variable &lt; sql:setDataSource &gt; database password

    Hello

    I hope someone can enlighten me on that.

    I am trying to create a jsp page that uses JSTL to access the database. Regulations in my company requires me to use the password for the encrypted database.

    Here is an excerpt of my codes. The error I get is the password = "${decryptedPassword}" never work. However, it can print the password correctly from "System.out.println ("password is"+ decryptedPassword);" How can I pass the variable 'decryptedPassword' in the password?

    Thank you very much!

    Steve

    < %
    System.setProperty ("oracle.net.tns_admin", "C: / NEW PC BACKUP/oracle/product/10.2.0/client_1/NETWORK/ADMIN");
    System.setProperty ("oracle.net.tns_admin", "/ usr/local/oracle/10.2.0.3/network/admin");
    String decryptedPassword = "";

    Logger.info ("PLANNER_REPORT_EDOW_PSWD_ENCRYPT_KEY = <" + keyAlias + ">");
    Logger.info ("PLANNER_REPORT_EDOW_PSWD_KEY_STORE = <" + keyStoreFile + ">");

    FStore FileBasedKeyStore = new FileBasedKeyStore ("/ usr/local/scripts/keystorefile/key.dat", null);
    If (fStore == null) System.out.println ("keystore is null");
    Key = fStore.getKey ("cities") (Key);
    If (key == null) System.out.println ("key is null");
    decryptedPassword = new String (CryptoUtil.decryptFromBase64 ("OIC/n5asIP6CDR01WwvXtw is", key));
    System.out.println ("password is" + decryptedPassword);
    % >

    < sql:setDataSource var = 'snapshot' driver = "oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@cngd" user = "citosapp" password = "${decryptedPassword}" / > "

    A variable in the Java code is not available as magically as a variable JSTL. You will need to add it to the requestScope for example (request.addParameter ()).

    Your confusion is proof enough that it is a very bad idea to put the Java code in your JSP pages. It leads to unreadable code. You should learn how to combine JSPs & servlets to separate the logic of the other Java and JSP code model.

  • PL/SQL function to calculate the non-working days

    Hello

    I have the following pl/sql function which generates a number of days between two selected dates (i.e. excluding weekends). However, I also need to exclude specific holidays - day of Christmas etc. These holiday dates are stored in a table in our database (11 GR 2) called "HOLIDAY".

    How can I integrate the holidays which is held in the table of holidays in the following query to exclude these dates as well? I know how to write a separate funtion pl/sql for a number of days between two dates using SELECT... BUT I can't work out how to bring together them in a single query.

    Could someone show me how with the pl/sql / dates below please?

    Example of HOLIDAY table below.

    Thank you!

    TP

    create or replace
    function WORKING_DAYS (pi_start_date in date, pi_end_date in date) return integer
    
    is
    
    v_start_date date :=pi_start_date;
    v_end_date date:=pi_end_date;
    v_count integer:=0;
    
    begin
    
    while v_start_date <= v_end_date
          loop
                            if to_char(v_start_date,'D') not in ('6','7')                    
                            then
                            v_count := v_count+1;                       
                            end if;
                           
                    v_start_date:=v_start_date+1;
                   
          end loop;
         
    return v_count;
    
    end;
    
    

    (select '10-Apr-2013' as NWD from dual union all
    select '06-May-2013' from dual union all
    select '27-May-2013' from dual union all
    select '26-Aug-2013' from dual union all
    select '26-Dec-2013' from dual union all
    select '25-Dec-2013' from dual union all
    select '01-Jan-2014' from dual union all
    select '18-Apr-2014' from dual union all
    select '21-Apr-2014' from dual union all
    select '05-May-2014' from dual union all
    select '26-May-2014' from dual union all
    select '25-Aug-2014' from dual union all
    select '25-Dec-2014' from dual union all
    select '26-Dec-2014' from dual) HOLIDAYS
    

    Hello

    the link is on MOSC, not OTN... Here's a copy:

    This function calculates the number of days between two dates, ignoring weekends and holidays (if requested and if the holidays are stored in a table)

    I give an example of table 'public_holiday' with sample data, but users must ensure that their table contains the relevant data (all holidays within the maximum range of use of the service)

    CREATE TABLE public_holiday (calendar_day, DATE, text VARCHAR2 (30));

    FUNCTION to CREATE or REPLACE nb_days (p_date_from IN DATE

    p_date_to DATE by DEFAULT TRUNC (sysdate)

    , p_public_holidays in CHAR DEFAULT 'Y '.

    ) RETURN NUMBER

    DEFINE AUTHID

    AS

    /*********************************************************************/

    / * Author: Bruno Vroman * /.

    / * Created: 23-AUG-2012 * /.

    / * Last updated: 23-AUG-2012 * /.

    / * Object: to calculate the number of days between 2 dates, to the exclusion of * /.

    / * Saturday and Sunday, but also "holidays" If the * /.

    / * argument 'p_public_holidays' = 'Y ' * /.

    / * Support: p_date_from<= p_date_to                             ="">

    / * component ' hour min dry "ignored (just counting days) * /.

    /* First step:                                                       */

    / * the calendar days between 2 days * /.

    / Remove 2 days for each "week" and 0 or 1 extra day * /.

    / * function to a condition "complex" mix day of first week * /.

    / * and the number of days when full remaining weeks are removed * /.

    / * (set up once for all, for example if there is 3 days and the * /)

    (/ * first day is a Thursday, there is 1 "Sat/Sun" to subtract) * /.

    / * Second step: If 'p_public_holidays' = 'Y': other * /.

    / * days, do not count holidays.                         */

    / Holiday everyday are defined in a table "public_holiday" * /.

    / * Note: there may be holidays defined on Saturday/Sunday.       */

    /*********************************************************************/

    l_result NUMBER;

    l_from DATE;

    l_to DATE;

    l_case tank (4);

    BEGIN

    l_from: = TRUNC (p_date_from);

    l_to: = TRUNC (p_date_to);

    l_case: = TO_CHAR (l_from, 'Dy', 'NLS_DATE_LANGUAGE = English').

    To_char (MOD (l_to - l_from + 1, 7));

    l_result: = l_to - l_from + 1

    -TRUNC ((l_to-l_from + 1) / 7) * 2

    -CASE

    WHEN l_case IN ('Mon6', 'Tue5', 'Wed4', 'Thu3', 'Fri2'

    , "Sat1", "Sun1", "Sun2', 'Sun3", "Sun4".

    , "Sun5', 'Sun6.

    )

    THEN 1

    WHEN l_case IN ('Tue6', 'Wed5', 'Wed6', 'Thu4', "Thu5"

    , 'Thu6', 'Fri3', 'Fri4', 'Fri5', 'Fri6 '.

    , "Sat2", "Sat3', 'Sat4', 'Sat5", "Sat6.

    )

    THEN 2

    0 OTHERWISE

    END

    ;

    IF SUPERIOR (p_public_holidays) = "Y".

    THEN

    SELECT l_result - COUNT (*)

    IN l_result

    OF public_holiday p

    WHERE p.calendar_day > = l_from

    AND p.calendar_day<=>

    AND SUBSTR (TO_CHAR (p.calendar_day

    , "Dy".

    'NLS_DATE_LANGUAGE = English'

    )

    , 1, 1 ) != 'S'

    ;

    END IF;

    RETURN l_result;

    EXCEPTION

    WHILE OTHERS

    THEN

    DBMS_OUTPUT. Put_line (' CTF nb_days (' |))

    To_char (p_date_from, "MON-DD-YYYY"). ', ' ||

    To_char (p_date_to, "MON-DD-YYYY"). ', ' ||

    p_public_holidays | ' ) : ' || SQLERRM

    );

    LIFT;

    END nb_days;

    /

    REM

    REM example:

    REM A) fill out the 'public_holidays '.

    REM

    TRUNCATE TABLE public_holiday;

    INSERT INTO public_holiday VALUES (DATE ' 2012-01-01', ' new year (a Sunday)');

    INSERT INTO public_holiday VALUES (DATE '' 2012-01-03, "for example");

    REM (insert other days...)

    COMMIT;

    Call the function for some pairs of dates of REM B)

    REM nb1: remove only Sat/Sun

    REM nb2: also remove holidays

    REM

    ALTER SESSION SET nls_date_format ='Dy DD-MON-YY';

    WITH some_dates AS

    (SELECT DATE ' 2011-12-29'd dual FROM

    UNION ALL SELECT DATE ' 2012-01-08' FROM dual

    UNION ALL SELECT DATE ' 2012-01-10' FROM dual

    )

    SELECT d1.d 'FROM '.

    , d2.d ' to THE '.

    , nb_days (d1.d, d2.d, ' don't) nb1

    , nb_days (d1.d, d2.d, 'Y') nb2

    OF some_dates d1

    some_dates d2

    WHERE d1.d<=>

    ORDER BY nb1, nb2, d1.d

    ;

    GO TO NB1 NB2

    ------------- ------------- ---- ----

    Monday, January 8, 12 Monday, January 8, 12 0 0

    Friday, December 29, 11 Friday, December 29, 11 1 1

    Wednesday, January 10, 12 Wednesday, January 10, 12 1 1

    Monday, January 8, 12 Wednesday, January 10, 12 2 2

    Friday, December 29, 11 Monday, January 8, 12 7 6

    Friday, December 29, 11 Wednesday, January 10, 12 9 8

    Hope that this could be useful, but note that this code has not been completely tested, so check and test before you trust it (in the case of any questions, please post a comment)

    Bruno Vroman.

    Best regards

    Bruno

  • How to create a table in a schema in the SOA database

    Hello

    can you please guide me how to create a table looks under custom schema available in the SOA database

    Thank you

    Valsaint

    Hello

    1. use JDeveloper to connect to your schema custom: view > Database > Database Navigator > new connection

    2. set the mpdel of your table column names, types of data, constraints (primary key, not null, foreign key, etc..)

    3. use this simplified tutorial to create the table according to your model of table create statement - Oracle/PLSQL: CREATE TABLE statement

    4. execute the statement in the SQL of JDeveloper journal for the custom connection (point 1 above).

    Let me know if you need help!

    HTH,

    A.

  • How to create a guest account? I followed the instructions and it says that it does not recognize the user!

    I followed the instructions to create a guest account and it says that it does not recognize the user's address or the password.

    Hello

    1. What is the operating system installed on the computer?

    2. are you trying to create or attempt to activate the guest account?

    3. How have you tried to create the guest account?

    4. What is the exact error you get when you try to create the guest account?

    Perform the steps in the articles to create a guest account and check if the problem is solved or not.

    Turn the guest account on or off (Windows 7)

    Turn the guest account on or off (Windows Vista)

    Hope that helps.

  • How to create a list of button by using the names of a table

    Hi, I want to create an application that displays detailed information about something. for example, as the profile of the users. my application will read an xml response from the server that contains the list of the names of the users. How to create a list of buttons using the names and then each button that displays the name that can be pressed and displays detailed information about the name? I think that it is similar to the BBM app that displays a contact list of the user. Thank you very much

    Create a ButtonField as:

    ButtonField [] users_buttons = new ButtonField [number of users];

    Initialize the uasing dem:

    for (int i = 0; i)<>

    users_buttons [i] = new ButtonField ("user", Field.FIELD_HCENTER |) ButtonField.CONSUME_CLICK);

    Make dem clickable setchangeListener method of buttonField and Ooveride Navigation click to make a few operatoin by clicking on the specific button!

  • How to create a button that is persistent on the top of the Gallery HTML page

    Hello

    My InDesign folio, I have an article with photo gallery full HTML page. The photo grid occupies the full screen. I want to create a button that is persistent on top of this gallery, which the user can type to go to the main Menu page. This button is always visible in one place, even as the user scrolls up and down the gallery. I tried to create it on the top layer and the upper layer of the page master, but the button disapperas loading the HTML gallery.
    If the user does not see any button to navigate through the Gallery to another article.

    Any ideas how to create persistent button?

    Thanks in advance.

    -MP

    Why not do things just like an HTML article? You do it in the Muse.

  • EBS 11i - how to create a responsibility that can only reset the passwords

    Hello

    I need to create a responsibility of helpdesk team reset user passwords, but do not do. I created a menu and I tried "UMX_FORGOT_PWD", "UMX_OBJ_PASSWD_MGMT", "UMX_RESET_PWD" works but without hope. What should I do or how can I add more effort to make it work?

    user13014069 wrote:
    Yes, I meant this one. But it has everything, it can create, edit, close a user so I don't want to use this menu. I want to create a responsibility that questionable users and reset their passwords, that is, not can change anything else.

    For this you must use the customization to restrict who has access to this responsibility / to make all actions other than resetting the passwords.

    How to customize the forms [ID 468657.1]
    Information about the ability to customize the form of Oracle Applications 11i [ID 279034.1]
    Sample unit test for the use of form customization in Oracle Applications [ID 744069.1]
    Limits of customization of forms [ID 420518.1]

    Document personalization of forms
    Document personalization of forms

    Thank you
    Hussein

Maybe you are looking for

  • iPhone 5 c water damage

    My son of 5 c stopped working all of a sudden he had in his backpack during a football match and it rained on.  The front of the phone was damp but not soggy.  In any case, it does.  We tried to put in a Bheestie bag 3 days to dry and has also replac

  • Split x 2

    Hi all I bought HP x 2 (mOO8tu) Split in November 2013. And now I have a problem about his fan.This portable fan makes a loud noise as if he came into collision of internal parts as well as when I change the position of the shelf permanently, the noi

  • convert HARD drive on HP 15-ay-011nr

    Hello I bought my computer with win10 installed but want to replace/upgrade to SSD HARD drive will have best perfromance I can do with cloning SW? or need to somehow get the iso file to win10 and run the clean install? any recommendations? Thank you

  • Can not handle t510 with ThinPro HPDM v4.6 sp2 v5.0

    We have recently updated our HPDM in v4.6 with SP2 and it seems to work perfectly. We have one of our customers light t510 upgrade then ThinPro v5, which went well, but now we cannot see or manage HPDM device! I hope that this is just an oversight on

  • WiFi is turned off equipment

    Hello In my Yoga pro 2, Intel wireless-n 7260 chip is hardware disabled when using linux. I checked with fedora, ubuntu and suse. The release of "rfkill list" is always the same: 0: ideapad_wlan: wireless network Soft blocked: no Hard blocked: Yes .