Insert twelve MONTH of the year into table A_MONTH

Could some help me with my simple SQL programming. Thanks
-Kenny
REM 2. Creates a table names fungue_table_ssss_nnnnnn with columns named A_Month, A_Date, A_Radius and A_Area.
Create table fungues_table_1442_794485 (
A_Month int,
A_Day date,
A_Radius number(9),
A_Area number(4));
REM 3. Enters records into the table by using loops, where A_Month is the month of the year, spelled out fully in capital letters, beginning with JANUARY and ending with DECEMBER.
Declare
Max_record constant number := 12;
I number := 1;
Begin
For I in 1..Max_record loop
Insert into fungues_table_1442_794485
(A_Month)
values
(I, sysdate);
end loop;
commit;
end;
null

SQLJ and JDBC are APIs for accessing the database from Java.
So do not be surprised there are not too many many takers for a PL/SQL programming exercise here. Or, try rewriting it in Java :)

Similar Messages

  • How can i open a DOC or TXT file and insert the data into table?

    How can i open a DOC or TXT file and insert the data into table?
    I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
    I'd like open DOC file and I'd like insert them into the table with same columns.
    Thanks.

    Use the SQL*Loader utility or the UTL_FILE package.

  • How to get the first month of the year inputed by user manually

    Hi Expert,
    Just like the subject, I 'd like to get the first month of the year inputed by user manually, but don't know how to set the variable, please help.
    For example, user execute a query and input the value of variable Year = 2010, and what I want to get is 201001 into another variable, so that I can use this variable to setup another selection.
    Thank you.
    Andy

    Hi Andy,
    1) U will create a user input varaible for year and say it is ZYEAR.
    2)  U will create another variable  for calmonth  which has processing type : customer exit ..single value ...mandatory ....say ZCMONTH.
    This needs to be populated using the year( user inputted )  and calmonth '001'
    This code will fetch the user input value into ZYEAR and append '001' to the user input value and the value
    will be passed to the ZCMONTH varaible...
    Sample Code is....
    When 'ZCMONTH'.
    IF I_STEP = 2.
         READ TABLE I_T_VAR_RANGE WITH KEY VNAM = 'ZYEAR'.
         IF SY_SUBRC = 0.
                    L_S_RANGE-LOW  =  I_T_VAR_RANGE-LOW.
                   L_S_RANGE-LOW+4(3) = '001'.
                  L_S_RANGE-SIGN = 'I'.
                 L_S_RANGE-OPT  = 'EQ'.
                      APPEND L_S_RANGE TO E_T_RANGE.
        ENDIF.
    ENDIF.
    Regards
    vamsi

  • I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. years each month.

    I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. year each month. I need to create a spreedsheet using the the Acutlas from the year-to-date and from last year-to-date, but need to report each month.

    Hi Tony,
    Answering your question would be easier given a screen shot of the source table and one of what you want the summary table to look like.
    Is the data you want for each month in a single cell o the source table, or does the summary table need to collect February's data (for example) from several cells and do some math with those numbers before presenting them on the summary table?
    Regards,
    Barry

  • HT5361 I want to delete my Verizon email account but I don't want to lose all of the messages I saved over the years into various mailboxes that I created "On My Mac" in Apple Mail.  Will they be erased / deleted when I delete the account?

    I want to delete my Verizon email account but I don't want to lose all of the messages I saved over the years into various mailboxes that I created "On My Mac" in Apple Mail.  Will they be erased / deleted when I delete the account?

    Yes, it's a POP account.  I kinda thought that the old messages would be safe in mailboxes "On My Mac," but since it's an irrevocable choice, I was reluctant to pull the trigger.  However, the suggestion above from keg55 relieves my concerns on that score; I'll make a backup copy before I delete the account just to be on the safe side.
    Thanks very much to both WZZZ and keg55, I really appreciate it!

  • Help needed badly Insert text data from xml files into tables

    Hi all, I have asked to do insertion of text from a xml file into tables upon receiving using pro*c. i've done quite an amount of research on xml parser in c but there wasn't much information for mi to use for implementation...
    Guys don't mind helping me to clarify few doubts of mine...
    1. Where can i get the oracle xml parser libs? Is it included when i installed oracle 8i?
    2. Is there any tutorials or help files for xml parser libs where i can read up?
    I need the xml parser to recognise the tags, followed by recognising the text after the tags.
    eg. xml format
    <studentID> 0012 </studentID>
    <student> john </student>
    <studentID> 0013 </studentID>
    <student> mary </student>
    text willl be inserted into tables like this:
    studentID | student
    0012 | john
    0013 | mary
    by the way i'm using oracle 8i on HP-UX. Thanks in advance.

    I can answer one of of your questions at least
    1. Where can i get the oracle xml parser libs? Is it included when i installed oracle 8i?You need the XML XDK. You can use http://www.oracle.com/technology/tech/xml/xdkhome.html as your starting point. I believe the 9i version works for 8i.
    I have no pro*c experience so I can't offer any other suggestions regarding how to do this in pro*c.

  • SQLLDR -- WHEN works only for the first INTO table

    I tries to load 2 table from one data file.
    SQLloader loads only the first table in the control file.
    If I switch the INTO sequence it then load the other table that now its the first in the control file.
    It works fine if I split the control into 2 controls that loads the table from
    the same data file.
    Is this a bug or am I forces to load it as two parts?
    -------------------------- control file ----------------------
    LOAD DATA
    INFILE 'test.xml' "STR '\n<ENDREC/>\n'"
    INTO TABLE MSDESTINATIONXML
    APPEND
    WHEN typeid = "D"
    FIELDS TERMINATED BY '^'
         typeid          FILLER char(1),
         ID          char(255),
         letterid      char(255),
         left           char(2000) TERMINATED BY '\n<ENDROW/>\n')
    INTO TABLE MSLETTERXML
    APPEND
    WHEN typeid <> "D"
    FIELDS TERMINATED BY '^'
         typeid          FILLER char(1),
         ID          char(255),
         bundleid      char(255),
         left           char(4000) TERMINATED BY '\n<ENDROW/>\n',
         right           char(4000) TERMINATED BY '\n<ENDROW/>\n')
    ---------------------------- end control file ----------------------------------

    This happens because of the processing of the form.
    You can see this here:
    LiveCycle ES2 * Adobe LiveCycle Designer ES2
    You have to put a own variable, which is set with the value you want in the very beginning.
    I know, it is not that logical in the first moment, but it makes sense.
    Regards
    Florian
    PS: This space SAP Interactive Forms by Adobe is the correct for questions like that

  • Averaging Columns (by months of the year)

    Running Oracle 9i
    I have this query which takes fields: ID, Date, and Data and performs a crosstab (matrix) query which has the day column, the 12 months, and the total for each day.
    I have been trying to add averaging for each month at the bottom of the result and total after that so that the result looks like:
    Day Jan Feb Mar ... Oct Nov Dec Total
    1 1.1 2.2 3.3 4.4 5.5 6.6 999.99
    2
    30
    31 3.3 6.6
    (currently looks like the above.. Need to change query so that the next two lines are displayed)
    Average 2.2 4.4 ....... etc.. 5.5 (blank)
    Total 4.4 8.8........ etc... 11.0 999.99
    I tried to use an example of the ROLLUP and just got different errors..
    Here is the current query:
    select to_char(piDate,'dd') as day
    ,sum(decode(to_char(piDate,'mm'),'01',piValue)) as Jan
    ,sum(decode(to_char(piDate,'mm'),'02',piValue)) as Feb
    ,sum(decode(to_char(piDate,'mm'),'03',piValue)) as Mar
    ,sum(decode(to_char(piDate,'mm'),'04',piValue)) as Apr
    ,sum(decode(to_char(piDate,'mm'),'05',piValue)) as May
    ,sum(decode(to_char(piDate,'mm'),'06',piValue)) as Jun
    ,sum(decode(to_char(piDate,'mm'),'07',piValue)) as Jul
    ,sum(decode(to_char(piDate,'mm'),'08',piValue)) as Aug
    ,sum(decode(to_char(piDate,'mm'),'09',piValue)) as Sep
    ,sum(decode(to_char(piDate,'mm'),'10',piValue)) as Oct
    ,sum(decode(to_char(piDate,'mm'),'11',piValue)) as Nov
    ,sum(decode(to_char(pidate,'mm'),'12',piValue)) as Dec
    ,sum(piValue) as Total
    ,max(reportid) as ReportID
    ,max(waterdatatypeid) as WaterDataTypeID
    from LPInflow
    where reportid=14 and pidate >=to_date('2006/01/01','yyyy/mm/dd') and
    pidate <= to_date('2006/12/31','yyyy/mm/dd')
    group by to_char(piDate,'dd'),to_char(piDate,'yyyy');
    Also, the reportid is the same for all, but just using reportid instead of min/max reportid causes the query to fail..
    If I could get the correct query systax it would be great..
    Thanks .Very Much appreciated..

    Hi Swaroop,
                        I have a issue with allocation logic i.e is my scenario require allocation logic or i can write general logic,if yes,can you give a suggestion how to write..
    Scenario is..in my plan..
    I prepared a schedule for SALES planing...for which i have prepared a input scedule..
    My input schedule works like..COLs-SalesAccountits memberset isfiltered using propety i.e test3="C"
                                                     ROWs-ENTITY--its memberset is  filtered using propety i.e Plants="A"
                                                     Time--Taking from CV.
    When i take time 2009.INPUT from CV and enter the data for entity for respect salesaccounts and send the data.NEXT,
    I want to copy the same data to all the months of 2009...for that iam using allocation like
    *RUNALLOCATION
    *FACTOR
    //*USING
    *DIM ENTITY WHAT=Entity;                    WHERE=<<<:              USING=Entity.PLANTS
    *DIM SALESAccount WHAT=SALESACCOUNT;  WHERE=<<<:  USING<>SALESACCOUNT.TEST3
    *DIM TIME WHAT=BAS(%YEAR%.TOTAL); WHERE=<<<;          USING=%TIME_SET%;
    *ENDALLOCATION
    will it work my scenario does i need to add any other logic ...
    Suggest me sol..
    regards,
    Naresh.

  • Calculating Length of Service - Splitting out the months from the years

    Hi folks,
    I was wondering if anyone might have the answer to a little employee length of service conundrum. I'm trying to construct a calculation that will calculate an employee's length of service in whole Years worked only. I also need to produce a second calculation to calculate length of service in whole months worked only but with the whole years worth of months deducted from it.
    For example if a persons hire date is 05-Feb-2001 the two calculations would return:
    Length of service Years 7
    Length of service Months 6
    The following calc will generate length of service as a decimalised number:
    MONTHS_BETWEEN(SYSDATE,Hire Date) /12
    So for my example person I get 7.64 years.
    I need to somehow round this down to the nearest 1 to get whole years service. I cannot use the ROUND function because it rounds to the nearest, so when a number is n.5 or higher it'll round up and will only round down when the number is n.49 or lower. grrr.
    My next mission is to work out months service based on whats after the decimal place. If I could round the Length of service Years down I think I could achieve this. I would just do:
    ROUNDDOWN(((MONTHS_BETWEEN(SYSDATE,Hire Date) /12) - (+ROUNDDOWN+(MONTHS_BETWEEN(SYSDATE,Hire Date) /12))*12)
    ROUNDOWN being my non-existent function!
    Any advice on this is greatly appreciated.
    Lloyd

    Hi,
    TRUNC is the function I always use to round down. It is more flexible than FLOOR as you can use it to round down to a number of decimal places.
    You should also understand that Oracle's definition of MONTHS_BETWEEN does not meet everyones expectations. For example MONTHS_BETWEEN('28-JAN-2001', '28-FEB-2001') is exactly 1 so is MONTHS_BETWEEN('31-JAN-2001', '28-FEB-2001') unless it is a leap year when it is slightly less. That's because Oracle treats the last day of the month as different when it calculates the months between 2 dates.
    Rod West

  • Set Parameter to pick up previous month and year unless first month of the year

    Hi,<o:p></o:p>
    I have a start and end date set to the same format (CCYYMM) and date.<o:p></o:p>
    I am running a report each month using the below expression.<o:p></o:p>
    =Year(Today()) * 100 + Month(Today().AddMonths(-1))<o:p></o:p>
    This functions correctly except when the report is run in January where the date returned is 201512 instead of 201412.<o:p></o:p>
    Can someone advise of how i can get this expression to show the correct month when i run this in January?
    M Stoker

    =Format(DateAdd(DateInterval.Month,-1,Today()),"yyyyMM")
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Using Cursor and FOR LOOP to INSERT the data into table

    Hi all,
    I have SELECT statement that returns 3 rows:
    PROCESSNAME
    PROTDATE
    IMM
    2013-12-18
    Metrology
    2013-11-18
    CT
    2013-12-04
    SELECT  processName, MAX(NVL(protStartDate, protCreateDate)) AS protDate
        FROM TABLE(SEM_MATCH("{
                ?ipc rdf:type s:Protocol .
                ?ipc s:protocolNumber ?protNum .
                ?ipc s:protocolCreateDate ?protCreateDate .
                OPTIONAL {?ipc s:protocolSchedStartDate ?protStartDate }
                ?ipra rdf:type s:ProcessAggregate .
                ?ipra s:hasProtocol ?iprot .
                ?iprot s:protocolNumber ?protNum .
                ?ipra s:processAggregateProcess ?processName.
        }",sem_models("PROTS", "LINEARS"),NULL, SEM_ALIASES(SEM_ALIAS("","http://VISION/Data/SEMANTIC#"),SEM_ALIAS("s","http://VISION/DataSource/SEMANTIC#")),NULL))
            Group by processName
    Now I need to INSERT these values into the table along with the other values.
    these other values come from different table.
           INSERT INTO MODEL_CLASS_COUNTS (MODEL_NAME, CLASS_NAME, INS_COUNT, COUNT_DATETIME, PROCESS_NAME, PROT_DATE)
           VALUES
           ("$MODEL",     
                "${i}",
            (SELECT COUNT (DISTINCT S)  FROM TABLE(SEM_MATCH(
                            "{?s rdf:type :${i} . }",SEM_Models("$MODEL"),NULL, SEM_ALIASES(SEM_ALIAS("","http://VISION/DataSource/SEMANTIC#")),NULL))),
             SYSTIMESTAMP, %%here need to insert PROCESSNAME, PROTDATE%%
    t was giving me error:
    PL/SQL: ORA-22905: cannot access rows from a non-nested table item
    so i enclosed sparql query into single quotes.
    The code is as follows:
    declare
    type c_type is REF CURSOR;
    cur c_type;
    v_process varchar2(200);
    v_pdate varchar2(200);
    begin
    open cur for
           ' SELECT processName,  MAX(NVL(protStartDate, protCreateDate)) AS protDate   <-- it's complaining about this being too long identifier, i think...
            FROM TABLE
              (SEM_MATCH (
                            ?ipc rdf:type s:Protocol .
                            ?ipc s:protocolNumber ?protNum .
                            ?ipc s:protocolCreateDate ?protCreateDate .
                            OPTIONAL {?ipc s:protocolSchedStartDate ?protStartDate }
                            ?ipra rdf:type s:ProcessAggregate .
                            ?ipra s:hasProtocol ?iprot .
                            ?iprot s:protocolNumber ?protNum .
                            ?ipra s:processAggregateProcess ?processName.
                        }",SEM_Models("XCOMPASS", "XPROCESS"),NULL,    
              SEM_ALIASES(SEM_ALIAS("","http://VISION/Data/SEMANTIC#"),
              SEM_ALIAS("s", "http://VISION/DataSource/SEMANTIC#")),NULL))
               Group by processName';  
    loop
    fetch cur into v_process, v_pdate;
    exit when cur%NOTFOUND;
    --here I need to insert v_process , v_pdate into my table along with other values...
    dbms_output.put_line('values for process and prod_date are: ' || v_process || v_pdate );
    end loop;
    close cur;
    end;
    exit;
    Now, I get an error:
    ORA-00972: identifier is too long
    Does anyone know way around this?

    Hi,
      I tested something similar with insert into select  and it worked fine :
    insert into t_countries(ID,CITY ,POPULATION, DESCRIPTION, located, insdate )
    SELECT 1 id, city, o , city||' is a nice city' description,  max(nvl(locatedAt,'unknown')) as located,
      SYSTIMESTAMP
      FROM TABLE(SEM_MATCH(
        '{GRAPH :gCH {<http://www.semwebtech.org/mondial/10/countries/CH/> :hasCity ?cityID .
           ?cityID :name ?city .
           OPTIONAL{?cityID :locatedAt ?locatedAt .}
           ?cityID :population ?o .
        SEM_Models('VIRT_MODEL_MONDIAL'),
        SEM_Rulebases(null),
        SEM_ALIASES(SEM_ALIAS('','http://www.semwebtech.org/mondial/10/meta#'),
        SEM_ALIAS('prv','http://www.semwebtech.org/mondial/10/countries/CH/provinces/')
        null))
        group by city,o
        order by city;
    Or with execute immediate :
    declare
      v_country varchar2(200) :='http://www.semwebtech.org/mondial/10/countries/F/';
      v_text varchar2(2000);
    begin
    v_text := 'insert into t_countries(ID,CITY ,POPULATION, DESCRIPTION, located, insdate )
    SELECT 1 id, city, o , city||'' is a nice city'' description,  max(nvl(locatedAt,''unknown'')) as located,
      SYSTIMESTAMP
      FROM TABLE(SEM_MATCH(
        ''{<'||v_country||'> :hasCity ?cityID .
           ?cityID :name ?city .
           OPTIONAL{?cityID :locatedAt ?locatedAt .}
           ?cityID :population ?o .
        SEM_Models(''VIRT_MODEL_MONDIAL''),
        SEM_Rulebases(null),
        SEM_ALIASES(SEM_ALIAS('''',''http://www.semwebtech.org/mondial/10/meta#'') ),
        null))
        group by city,o
        order by city';
        dbms_output.put_line(v_text);
        delete from t_countries;
        execute immediate v_text ;
        commit;
    end;
    Marc

  • How to insert the '&' character into table which is between in a string

    SQL> create table s(ss varchar(10));
    Table created.
    SQL> insert into s values('2 & 3');
    Enter value for 3:
    old 1: insert into s values('2 & 3')
    new 1: insert into s values('2 ')
    1 row created.
    SQL> select * from s;
    SS
    2
    SQL> drop table s;
    Table dropped.
    SQL> create table s(ss varchar2(10));
    Table created.
    SQL> insert into s values('2 & 3');
    Enter value for 3:
    old 1: insert into s values('2 & 3')
    new 1: insert into s values('2 ')
    1 row created.
    SQL> select * from s;
    SS
    2
    SQL> drop table s;
    Table dropped.
    SQL> create table s(ss nvarchar2(10));
    Table created.
    SQL> insert into s values('2 & 3');
    Enter value for 3:
    old 1: insert into s values('2 & 3')
    new 1: insert into s values('2 ')
    1 row created.
    SQL> select * from s;
    SS
    2
    SQL> drop table s;
    Table dropped.
    SQL> create table s(ss char(10));
    Table created.
    SQL> insert into s values('2 & 3');
    Enter value for 3:
    old 1: insert into s values('2 & 3')
    new 1: insert into s values('2 ')
    1 row created.
    SQL> select * from s;
    SS
    2
    SQL> drop table s;
    Table dropped.
    SQL> create table s(ss nchar(10));
    Table created.
    SQL> insert into s values('2 & 3');
    Enter value for 3:
    old 1: insert into s values('2 & 3')
    new 1: insert into s values('2 ')
    1 row created.
    SQL> select * from s;
    SS
    2
    Edited by: user10438587 on 06-Jan-2009 07:57

    Here is one way ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.41
    satyaki>
    satyaki>
    satyaki>select '2 '||chr(38)||' 3' res from dual;
    RES
    2 & 3
    Elapsed: 00:00:00.20
    satyaki>Regards.
    Satyaki De.

  • Wish I could create album by month of the year

    Hi all -
    I'm creating a photo calendar again for my family. In each month, I want to have pictures from that month. There are years of work in my 7200 photos. Is there any way to create a smart album that only has pictures taken in March, for example? I can create an album for March of 2008 but not for March only, from 1999-2008. Are there any third party software solutions that are able to mine the photo data to create such an album?

    Create a smart album with a date range for each month:
    Click to view full size
    That should do what you want.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. Just put the application in the Dock and click on it whenever you want to backup the dB file. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    Note: There's now an Automator backup application for iPhoto 5 that will work with Tiger or Leopard.

  • Generate yearmonth for every month of the year

    Hi,
    I need to generate all the dates in the format of yyyymm starting with the last month.
    I mean something like below :
    rownum            yearmonth
    1                       201204
    2                       201203
    3                       201202
    4                       201201
    5                       201112
    ...I know we need to make of pseudo column LEVEL, but cant seem to make it work. Please advise.
    Thanks
    Billu

    Thanks for responding.
    marcusrangel -- I need to use the list of dates from the query for every cutoff that we have for comparision.
    stew -- your query worked just fine.
    Thanks

  • Is there an alternative to Creative Cloud as I lack internet 6 months of the year?

    In the past one could purchase a program (Page Maker/ In Design etc) and run it while not connected to the internet. I cannot see how one can use the CC option and I am just switching from XP to Windows 8 which will not run Page Maker. Any suggestions other than looking for a second hand copy of In Design?

    You can still purchase CS6 versions of Adobe software. 
    Purchase CS6 products:
    http://www.adobe.com/products/catalog/cs6._sl_id-contentfilter_sl_catalog_sl_software_sl_c reativesuite6.html
    Trial versions are also available if you want to try before you buy.
    http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html
    http://prodesigntools.com/adobe-cs6-direct-download-links.html

Maybe you are looking for

  • Apply template to html page

    Hi - I must be missing sth big, I just can't relate a template (.dwt) with a page (.htm). Both files are in the same folder, the site's associated folder, but the site does not show any templates ('no templates' on the 'select template' dialog box).

  • OBPM Workspace Cascade StyleSheet (CSS) Loading Page Stuck

    Hi there, I´m facing a serious problem ! We have implemented ALBPM workspace to end users on my customer ! The main problem is regarding a weird behavior. When users are working through ALBPM Workspace (deployed into ALBPM for WebLogic Server) someti

  • Installation of OBIEE 11.1.1.6 in HP Unix

    Hi, I want to install OBIEE 11.1.1.6 in a HP-Unix machine.So anyone please tell me what are the software required for the installation of OBIEE 11.1.1.6 and how to install it? Can anyone please tell what are the prerequisites required for the install

  • Dbms_output.put_line platform issue

    the next code prints the date without the hour when i rum it on pl/sql developer 7 and with the hour when i run it in sql navigator 3. how can i force printing the hour on my machine (i dont think that it has anything with the date format settings) b

  • Box-to-Box redundancy question ?

    guys, i have two CSS 11506 configured as Box-to-Box Master/Backup mode. im trying to apply the commit_redundancy "argument" command from the Master CSS the configuration has been sent to the Backuo EXCEPT the commands related to ssl certiface that th