How to declare a list of dates

Hello

I have a question what type is "show as text based on LOV. I put in the source section under the "Body of the Pl/SQL function" type the following pl/sql function:
DECLARE
X VARCHAR2 (4000);
Y DATE ;
BEGIN
X := 'SELECT distinct(TO_CHAR(DATE1, ''YYYY'')) d, (TO_CHAR(DATE1, ''YYYY'')) r FROM SIVOA.EVV_'|| :p4_site ||' WHERE CLEF_VAR = (SELECT CLEF_VAR FROM SIVOA.SITE_DEBIT_RIVIERE WHERE SITE ='''|| :p4_site ||''')
order by d';
EXECUTE IMMEDIATE X INTO Y;
RETURN Y ;
END;
The problem is that I get an error ORA.
ORA-00932: inconsistent data types; EXPECTED:; obtained:-

I know I said Y as a date and that which is returned by my function is a list of dates. I don't know how to report a list of dates or anything to be returned as a lily of the values. I hope that I am clear, sorry for my English.

Thank you for your help.

Christian

You must return the string SQL, not a date value:

DECLARE
X VARCHAR2 (4000);
BEGIN
X := 'SELECT distinct(TO_CHAR(DATE1, ''YYYY'')) d, (TO_CHAR(DATE1, ''YYYY'')) r
FROM SIVOA.EVV_'|| :p4_site ||' WHERE CLEF_VAR = (SELECT CLEF_VAR FROM
SIVOA.SITE_DEBIT_RIVIERE WHERE SITE ='''|| :p4_site ||''')
order by d';
RETURN X ;
END;

Tags: Database

Similar Questions

  • How to have the list of dates automatically updated the site, without manually changing in Muse

    Hey, I design a site for a group that I play the drums in and I was wondering how I could update the list of concerts, we have, without having to manually edit in Muse then download again. Is there a way to past shows being removed without doing me it manually?

    I believe you are referring to events with calendar on the page where you can update the calendar with the dates, in which case you use the event of third party system then Muse will not control it, but if you created that in Muse itself then you will need to manually edit of Muse.

    If the site is hosted on BC, then you can use the events module to view the dates and details, the end site, you can schedule events and that expired will be removed from the calendar.

    Thank you

    Sanjit

  • How can I get my email listed by date, not alphabetically?

    * Original title: E - Mail

    How can I get my email listed by date, not alphabetically?

    Please tell us what email program you use.

    In most e-mail programs, you can click on the title of 'Date '. If lists in reverse chronological order, click the heading a second time.

  • How can I get the list of data stores in a cluster data store?

    How can I get the list of data stores in a cluster data store? I mean the command line option.

    Hello

    by command line, you mean PowerCLI?

    If so, you can display data with this warehouses:

    Get-DatastoreCluster-name DSClustername | Get-Datastore

    Tim

    Edit: Moved the thread to the PowerCLI community

  • How to export the list of devices in the Profile Manager?

    Hello

    is there a way to export the list of devices in the Profile Manager on a mini mac running OS Server 5.3?

    Thank you

    How to export data from device in the Profile Manager

    How to export a list of devices and their info?

  • I tried to download a pdf and convert them into excel, but the data in excellent is always to the image format.  How can I get the pdf data into the columns and rows?

    I tried to download a pdf and convert them into excel, but the data in excellent is always to the image format.  How can I get the pdf data into the columns and rows so that I can do the calculations?

    If you start the https://forums.adobe.com/welcome Forums Index

    You will be able to select a forum for the specific Adobe products you use

    Click on the symbol "arrow down" on the right (where it is said to see all our products and Services) to open the drop-down list and scroll

  • How to use powershell to create data warehouses Fibre Channel

    Hello

    Does anyone know how to use powershell to create data warehouses Fibre Channel?

    A text file lists the data warehouse with data store names and sizes (GB) as input:
    DatastoreName1 10
    DatastoreName2 200
    DatastoreName3 10

    Version5 VMFS file system
    Block size of 1 MB

    The script should ignore LUN ID 0 as long as it is not a data store, it's a startup logic unit number.

    The value in $esxname is correct?

    Do you want to see this name when you

    Get-VMHost | Select name

  • create a list of dates for the month of spefic

    I need to create the function that I send two parameters frist for year (2013) and the second prameter for months (09)

    to exit the list of dates this month.

    Hello

    What kind of data do you want to return the function?

    Here is a function that returns a cursor:

    FUNCTION to CREATE or REPLACE days_in_month
    (ENTIRE year
    ENTIRE month
    )
    RETURN SYS_REFCURSOR
    DETERMINISTIC
    IS
    c SYS_REFCURSOR;
    START_DATE DATE: = ADD_MONTHS (DATE ' 2000-01-01')
    , (12 * (year - 2000)) + month - 1
    );
    BEGIN
    OPEN FOR C
    SELECT the LEVEL - 1 AS a_date + start_date
    OF the double
    CONNECT BY LEVEL<= add_months="" (start_date,="">
    -start_date
    ;

    RETURN C;
    END days_in_month;
    /

    You can test it in SQL * more like this:

    M VARIABLE REFCURSOR

    EXEC: m: = days_in_month (2013, 9);

    PRINTING: m

    This function tries to avoid mistakes.  For example, if you pass 0 as the months, it triggers an error; It assumes that you meant the month before 1, i.e. from December of the previous year.

    How can you get pln to use?  Perhaps a pipeline function would be your needs better, or no function at all: just a subquery.

  • How to pass a list as a bind variable in SQL Developer?

    How can I pass a list as a bind variable in SQL Developer?

    The following query in SQL Developer so work I put ": prmRegionID = 2.

    SELECT COUNTRY_ID,
    COUNTRY_NAME
    OF HUMAN RESOURCES. COUNTRY
    WHERE IN REGION_ID (: prmRegionID);

    The problem is that I can't find how to set ": prmRegionID = 2, 3.

    I know that I can replace ": prmRegionID" by a proxy '& prmRegionID '. The above query will work well with"& prmRegionID = 2" and with "& prmRegionID = 2, 3". "

    But with this solution, I lost all the benefit of the use of bound variables (analysis hard against soft parse, possibility of SQL injection, etc.).

    I'm learning how to do this in SQL, as well as the use of UDT in this thread: How to move a list as a bind variable?

    But with this solution, I've lost nice SQL Developer user interface. In SQL developer, it is easy to test a query using the standard binding variable. When we start the application, a pop up asking for a value of the variable binding.

    With the UDT, the interface request always variable binding standard. You have an idea on how I can get a variable string binding (such as 1, 2, 10) in a set of NUMBER or VARCHAR2? This way I would be able to launch a standard query in SQL Developer to test my application.


    Can someone tell me what is the best approach to this?

    Thank you in advance,


    MB

    Hi Blais,

    Thank you for trying the SQL and PL/SQL instance before coming here - it was definitely the right approach, and you've got some very good suggestions there. Your needs for a invite only bind to the value in the clause list, I think I have a possible solution. I'll introduce you to a list of characters, so you'll have to tweak it for other types of data. First, add the following to your schema:

    create or replace
    TYPE bind_tab_typ AS TABLE OF VARCHAR2(4000);
    
    create or replace
    FUNCTION comma_to_table(iv_raw IN VARCHAR2)
    RETURN bind_tab_typ
    PIPELINED
    IS
       ltab_lname dbms_utility.lname_array;
       ln_len     BINARY_INTEGER;
    BEGIN
       dbms_utility.comma_to_table(list   => iv_raw
                                  ,tablen => ln_len
                                  ,tab    => ltab_lname);
       FOR i IN 1 .. ln_len LOOP
          PIPE ROW (ltab_lname(i));
       END LOOP;
    END;
    

    Now you can write a query, say for scott.dept, as follows, and have executed statement ask the value list in the clause as a single binding variable:

    select *
    from dept
    where dname in (
      select * from table( comma_to_table( :BNDS ))
    );
    

    When you are prompted, provide the list of values separated by a single comma without any extra spaces.

    I don't know if the Varchar2 (4000) really needs to be which is great. I use it because that's what dbms_utility.lname_array uses.

    Kind regards
    Gary
    SQL development team

  • How to get a list of the tables more fragmented in Oracle?

    Is there a SQL on how to get a list of the tables more fragmented in the Oracle DBMS?

    Update the statistics on the table and try this, you should see very fragmented tables upstairs with high wasted_space.

    select table_name,round((blocks*8),2) "size (kb)" ,
                                round((num_rows*avg_row_len/1024),2) "actual_data (kb)",
                                (round((blocks*8),2) - round((num_rows*avg_row_len/1024),2)) "wasted_space (kb)"
    from dba_tables
    where (round((blocks*8),2) > round((num_rows*avg_row_len/1024),2))
    order by 4 desc
    

    I changed the query a little because the ORDER BY will not work if we concat | ' Ko ' with the column because this makes the output a character column data.
    And added a WHERE condition to see that these tables where the total size is greater than the actual size of data.

    Published by: zahid79 on July 23, 2010 13:40

  • How to display the list of all the constraints, triggers, procedures... .etc

    Hello
    How to view a list of all the available constraints, triggers, procedures, functions and packages in a database. And how to view its definition?

    user12222356 wrote:
    Not working is this said sql statement "object"sys"". "" DBA_OBJECTS"does not exist"

    OK, so the problem is that you have not allowed access to any data dictionary table. If you want to be able to view all of the DBA_ * dictionary of data tables, you need the ADMINISTRATOR to grant you the privilege to CHOOSE ANY DICTIONARY.

    In the future, when you post an error message, in addition to displaying the error message, it will be useful if you can get the error number, for example, that is, ORA-xxxxx

    Justin

  • Link a JSF table to a list of data that does not come from a database

    Extract data from a database, I can just jDev Wizard allows you to 'Create EJB from the table' and link the EJB to a table of JSF in a NamedQuery.

    However, in this case I am recovering from a list of data from an existing API or a Web service.

    Someone at - it a good example of the best way to do it?

    Hi Owen,.

    You mean that you do not use anything from the ADF (RC components or controls data)?

    Extract data from a database, I can just jDev Wizard allows you to 'Create EJB from the table' and link the EJB to a table of JSF in a NamedQuery.

    The principle must be the same, regardless of how you get the data you return from the method (NamedQuery or something else).
    Your example seems ok, so 4) is clear to you (I don't know how you lie the DataTable to the method, never used).

    Pedja

  • A loop in a refcursor for the list of dates as a string

    Hello
    I have a simple procedure that gives me the list of dates and dates
    I need to get the dates dates separated by commas
    I don't know if this can be done directly by making a loop on the refcursor or I have to go pick her up in a file/table and then concatenate with comma, or is there anything else that can be done.
    I tried some stuff like below

    PS help out me
    the procedure is that returns the list of dates
    CREATE OR REPLACE procedure SALUSER.prm_sp_rpt_payslip_lop_dates(p_empid in int,p_tran_year in int,p_tran_month in integer,o_dates out sys_refcursor)
    as
    begin
     open o_dates for select  to_char(PHL_LOP_FROM,'DD-Mon-YYYY'),to_char(PHL_LOP_TO,'DD-Mon-yyyy') 
                     from prm_h_lop
                     where phl_emp_id=p_empid
                       and phl_tran_year=p_tran_year
                       and phl_Tran_month=p_tran_month;
    
                   
     end;
    /
    I need my o/p as
    dates :<date1>,<date2>...etc
    Kind regards

    Maybe sth. as

    SQL>  var cur refcursor
    
    SQL>  declare
     cr sys_refcursor;
     procedure prm_sp_rpt_payslip_lop_dates (cr in out sys_refcursor)
     as
     begin
       open cr for select hiredate from emp;
     end prm_sp_rpt_payslip_lop_dates;
    begin
     prm_sp_rpt_payslip_lop_dates(cr);
     open :cur for select 'Dates: ' || column_value dates from xmltable('string-join(//text(), ", ")' passing xmltype(cr));
    end;
    /
    PL/SQL procedure successfully completed.
    
    SQL>  print cur
    
    DATES
    --------------------------------------------------------------------------------
    Dates: 17-Dec-1980, 20-Feb-1981, 22-Feb-1981, 02-Apr-1981, 28-Sep-1981, 01-May-1
    981, 09-Jun-1981, 19-Apr-1987, 17-Nov-1981, 08-Sep-1981, 23-May-1987, 03-Dec-198
    1, 03-Dec-1981, 23-Jan-1982                                                     
    
    1 row selected.
    
  • How you sort the list of the next iOS 10?

    I can't know how to sort the list by following in-app music on my iPhone 6 s.  In iOS 9, he had a handle on the right side next to the title of the song that you can tap and drag up/down to change the order of the playlist.  The handle does not appear in the App on iOS 10 music.

    So I guess you can't have activated repeat function.  Once it is off, the handles appear and you can sort your list of songs until the next.

  • How to make the list of instrumental music

    How to make a list of all my player someone help

    Alan

    iTunes is not a method to determine what tracks have vocals. You can create a normal playlist and put what you want in it.

    TT2

Maybe you are looking for

  • Installed hard drives data recovery serial

    As many other users on these boards, by X 205 won't start. My question: How can I recover the data on my hard drive, since there are two of them? I ran a search to find all the files I wanted (*.jpg in this case) and the search came back with hundred

  • Why do not the forward/back arrows work anymore - they are gray?

    When I start a new window or tab arrows forward/reverse do not work and are grey. I can get the previous sites by right click. I also have a left tab of orange "Firefox" in the upper menu. It seems that I have a Firefox window on top a regular window

  • iPhone not backup to iCloud

    My 6s iPhone and iPad are not backup in iCloud. I think that I put everything properly in devices and the iMac, but it doesn't seem to be the case. I have a lot of space iCloud. I have IOS and OS X Thank you Carl

  • the speed setting of the title of star wars

    Hope someone can help me urgently. IM using the Star Wars title type and it is running fast how can I implement the speed to be able to read it. Thanks in advance!

  • Referring to a Page Field in an INSERT statement used in a trigger

    Hi guys,.The following throws an error year I'm sure it's because of the way I am referencing the Alert_ID page 4... can anyone help with my bad syntax here please? .....  INSERT INTO am_alertevents (event_description, alert_id) VALUES ("Proposed Act