Using variable date in a VIEW

Can I create a view in Oracle whereby the date I use to select the records can be a variable?
For example:
select * from marketer_account
where '30-NOV-2009' between mka_eff_dt and mka_exp_dt
and mka_service_type = 'E';
I want to get a list of all records on the marketer account table that were active on 30-NOV-2009.
But more importantly the users want a view that they can run every month to get this information, so in another month we may need the same query but:
select * from marketer_account
where '31-DEC-2009' between mka_eff_dt and mka_exp_dt
and mka_service_type = 'E';
So I want to replace the '31-DEC-2009' with a generic date. I tried this:
select *
from marketer_account
where last_day(add_months(sysdate,-2)) between mka_eff_dt and mka_exp_dt
and mka_service_type = 'E';
This will take the last day of 2 months ago from current: ie. If they run it now, they will get 31-JAN-2010 here.
Is this OK to do? Or is there a better way? Maybe the users want to change the date and run it for a date of their choosing?

Hi,
Besides SYS_CONTEXT, you can also store the base date in a table. If you make it a Global Temporary Table, then different sessions can use different parameters at the same time. You can even have multiple copies of the the same view in the same query, all with different parameters.
If the variable date is always the same distance from today's date, then you can simply use SYSDATE in the view.
For example, to find what was active on the last day of the month 3 months ago:
select  *
from  marketer_account
where   ADD_MONTHS (TRUNC (SYSDATE, 'MONTH'), -2) -1
        between mka_eff_dt
        and     mka_exp_dt
and     mka_service_type = 'E';If you run this any time in March, 2010, it gets the same results as:
select  *
from  marketer_account
where   TO_DATE ('31-Dec-2009', 'DD-Mon-YYYY')
        between mka_eff_dt
        and     mka_exp_dt
and     mka_service_type = 'E';but in April, it's as if the magic date was automatically changed to '31-Jan-2010'.

Similar Messages

  • How do I create multiple-up pages populated with variable data?

    I am trying to create a variable data Illustrator file but with a catch, I have to create multiple points of data on one artboard.  I am using a template with 36 identical shapes, and I'm trying to add a different image to each based off of using variable data.  I understand the premise of creating multiple output files based off of an illustrator file and data, but I have to create a single output file using 36 points of data, all QR codes.  The reason is that this 36-up 14.5" x 14.5" sheet will be printed on a large format inkjet and then be fed into another machine (not a cutter) that requires that specific layout for it's process.  I cannot create individual files, I need sheets based off of my 14.5" x 14.5" 36-up template.
    Any suggestions other than making each shape in the template a separate variable (even though they are all the exact same shape) would be greatly appreciated.
    My goal is to populate each of these shapes with a different QR code and then output the whole sheet as a single .EPS or .PDF file.

    My goal is to populate each of these shapes with a different QR code and then output the whole sheet as a single .EPS or .PDF file.
    You're barking up the wrong tree for this with Illustrator's Variables palette.
    Think of it like this:
    Imagine a typical spreadsheet with multiple rows of the same kind of data, except for the first row which serves as the "labels" of the columns.
    The on-page objects which you define as Variables in Illustrator correspond to the first row; the column labels.
    The datasets correspond to the following rows of values below the label row.
    Cycling through the datasets simply moves up and down the rows, revealing one row's data at a time for each of the column labels.
    Your multi-up array does not fit that data model. You are essentially trying to make a layout showing all the individual cells below the single label of one column (downward across all rows). (Illustrator's Variables feature doesn't even let you put multiple instances of a single variable in the document, so that the same value occurs in multiple places.)
    You're trying to build the functional equivalent of a typical "gang up" press sheet, like a 10-up layout of business cards, each showing the same kind of data (name, phone, etc.) for multiple employees, so that you don't have to do separate press runs for each employee. That's certainly a common need, and one quite appropriate to a program like Illustrator. But Illustrator's Variables feature does not do that.
    Essentially, what you are wanting to do is to replicate the basic functionality of any program which is used to print labels from data (like the typical mail merge function for address labels which are ganged up with some number of different labels on a page). What you want could be done in Illustrator via a custom JavaScript, but it would be a pretty silly exercise in reinventing the wheel. If it were me, I'd probably build the solution in FileMaker Pro (a database program), depending on the specific graphics requirements. However, you should be able to do it in InDesign, using its data merge feature.
    JET

  • Variable data in Illustrator

    Hello,
    Before I go crazy here, I am wondering if you can populate a document with a different image and name using variable data.
    Can the image and name be outside the document in an excel sheet for example? If so, how would images be handled...
    If anyone could lead me to a really good tutorial on this, I would he very grateful.
    The ones I have found so far, are not helping me.
    thanks!!
    babs

    Babs,
    You can use the Variable Data feature (the Variables palette) to create DataSets. You can then "bind" objects on the page to act as "placeholders," so to speak, for the text, images, visibility settings, or graph data that is contained in the current DataSet. You can then switch between DataSets to automatically re-populate the "placeholders." You can then semi-automate the swapping out of the DataSets to, for example, run exports or saves or prints in batch mode.
    The file that contains the data can be an external file that you import as an Illustrator Variables Library.
    However, the Variables feature set is based on XML, not on ordinary tab-delimited rows/columns like you are accustomed to in Excel. So you can't import an Excel file or any other ordinary row/column delimted text file into the Variables palette to create your DataSets. Excel and other programs (FileMaker Pro, for example) can export  XML from their rows/records. But unfortunately that's not all there is to it.
    XML is a tag-based markup language. An XML file doesn't necessarily follow a consistent rows/column kind of order germane to a spreadsheet or database table. The occurrances of Column/Row intersections (Elements) can be arbitrary. For example, imagine a spreadsheet with columns A, B, and C, and rows 1, 2, and 3. The arrangement in an XML file is not necesarily:
    1A, 1B, 1C
    2A, 2B, 2C
    3A, 2B, 2C
    It may be:
    1A, 1A, 3A, 2B, 2C, 1B, 1B, 1B....
    ...or any other arbitrary order and/or nesting arrangement of the Elements.
    So an XML file has to be "described" in order to be understood by the program that imports it. The XML file contains reference to a Schema or a Document Type Definition (DTD file) for that purpose. So to use Illustrator's Variables palette in that way, you have to get somewhat into the arcana of XML.
    That's about the extent of what I know about XML. Correction by anyone who acutally understands and works with XML is welcome.
    I haven't taken any polls, of course, but I dare say that the vast majority of users who actually ever touch the Variables palette just tediously enter the data directly into the bound objects in the Illustrator document and capture the DataSets as they go. A small minority does that with just a few sample DataSets, then exports the DataSets as a Variables Library (an XML file), and uses that file as the "template" into which they then insert the rest of the data from their spreadsheet or whatever, using a script or some other semi-automated routine. An even smaller minority actually creates the ready-to-import XML file from scratch.
    I have found it possible to import XML exported from FileMaker Pro directly into InDesign. But I cannot do that in Illustrator. For text-only purposes, I have resorted to writing a Javascript that lets me enter (or paste) ordinary tab-delimited text into a text object in Illustrator. The script then converts that text to Variable DataSets. I imagine it would not be hugely difficult to modify that script to also accommodate references to linked images, but I have not had the occasion or need to do so.
    I personally think the Variables feature would have been of much broader value across the AI user base had it been based on straightforward tabular data, like the data merge features in many programs, instead of XML. I guess that would be anethema to the XML users whom I assume must have asked for this feature being implemented this way. Or, it may have just been driven by Adobe-internal "me, too" gotta-have-it direction.
    JET

  • How to use variables in data slices?

    Hello,
    in BI-IP I have tried to use variables in a data slice.
    The user should fill these variables.
    How can one use and fill these variables?
    Thank you
    Daniel

    Hello Horst,
    data slice is a very strong system lock. It is normally not a good decission to allow users to control this part becuse it sould be in administration of a responsible person.
    If you allow users in the web to open or close data slices, this is like a "open period" funtion in financials: Think about what could happen, if anyone else than the responsible person could do that....
    This is my point of view.
    I would do it in anoter way: Create an User exit and fill a variable like desribed above. You read each line and make a decission whether the user might see this line or not (e. g. period open? yes or no?). The period and the status for the period could be maintained in a table or in a characteristic. table might be easier.
    regards
    Eckhard

  • How do i filter the records in analytic view by using variable/parameter for a time range

    i have a analytic view which has a output column as date type. i want the user who use this view have the control to decided the output records based on a time range (from x to y).
    i tried to create 2 variables, 1 for start_time, 1 for end_time. Ideally, i should have a expression for filtering data like this:
    $$start_time <= date_column <= $$end_time
    However, the variable windows doesn't seem to be feasible for the expression as above.
    Does anyone has the same problem and get it solved?
    Thanks!

    just figured out by my own. So the answer is using "variable" with "range" option.
    Making a variable, then set the "selection type" to "range".
    When preview the data, the variable input window pops up with operator on default "equal", use dropdown list to swtich it to "between", then you can enter the start_time and end_time as a range filter.

  • Using variables to insert data in the table

    I want to insert datas in the table. I use constants,
    all the constants are stored properly in the table. But,
    when I use variables I get the error message
    "Too few parameters. expected 6".
    (I declared all the fields of the table as text only.)
    My program is "newt.jsp"
    <%@ page language="java" import="java.sql.*" %>
    <html>
    <head>
    <title>storing customer information in the database</title>
    </head>
    <body>
    <%
    String cno1 = request.getParameter("cno");
    String n1 = request.getParameter("n");
    String add11 = request.getParameter("add1");
    String add21 = request.getParameter("add2");
    String phone1 = request.getParameter("phone");
    String email1 = request.getParameter("email");
    Connection con = null;
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:customer"," "," ");
    Statement statement1 = con.createStatement();
    Statement statement2 = con.createStatement();
    statement2.executeUpdate("create table cust1 (cno varchar(20),n varchar(20),add1 varchar(20),add2 varchar(20),phone varchar(20),email varchar(20))");
    statement1.executeUpdate("insert into cust1 (cno,n,add1,add2,phone,email) values(cno1,n1,add11,add21,phone1,email1)");
    catch(SQLException sqle) {
    System.err.println(sqle.getMessage());
    catch(ClassNotFoundException cnfe) {
    System.err.println(cnfe.getMessage());
    catch(Exception e) {
    System.err.println(e.getMessage());
    finally {
         try {
         if(con!=null) {
              con.close();
    catch(SQLException sqle) {
    System.err.println(sqle.getMessage());
    %>
    <br><br>
    Mr./Ms. <%=n1 %> <br>
    Your datas have been stored.<br>
    </body>
    </html>
    Those who know answer please reply.
    My thanks in advance.

    I would expect your insert statement to be this:
    statement1.executeUpdate("insert into cust1 (cno,n,add1,add2,phone,email) values('"+cno1+"','"+n1+"','"+add11+"','"+add21+"','"+phone1+"','"+email1+"')");
    If you just create a string, it's not going to fill in variables into the string by magic.

  • What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?

    Hi All,
    I am new to TestStand. Still in the process of learning it.
    What are Parameters? How are they differenet from Variables? Why can't we use variables for passing data from one sequnece to another? What is the advantage of using Parameters instead of Variables?
    Thanks in advance,
    LaVIEWan
    Solved!
    Go to Solution.

    Hi,
    Using the Parameters is the correct method to pass data into and out of a sub sequence. You assign your data to be passed into or out of a Sequence when you are in the Edit Sequence Call dialog and in the Sequence Parameter list.
    Regards
    Ray Farmer

  • Used variable substitution to substiture the field 'date' in file name

    Hi gurus
    I have used variable substitution to substiture the field 'date' (dd/MM/yyyy/hh/mm/ss) in the file name so when empty payload (a valid xml ) is generated by Message mapping then the communication channel is failing by showing the following error
    File processing failed with com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during
    variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload
    : date
    As of now the business is not getting effected as the business scenarion needs only customer master data at the reciever side But when ever there is no custmer master data in the sourse side the message mapping is generating an empty payload and the communication channel is failing ( so it is an internal issue and is there any way which could solve the both (ie the business must not get effected and as well the communication channel must not fail)
    any coments on this will be higly apreciated
    thanks and regards
    sandeep

    Hi Sandeep -
    Yes If you use the Variable substitution from the payload , that perticular field has to be generated in the target structure.
    To handle this You can do the following:
    Sourcefield --->exists -> IfThenElse-->TargetField
    Where     SourceField>exists(node function)-> If
                   SourceField -
    >Then
                   CurrentDate(Date Function)----->Else
    Hope this will help !!
    Regards.
    Jeet.

  • Using variables in data rules

    Hi,
    I have set-up a data transfer mechanism between serveral Essbase cubes that uses on the source cube a report script to generate a file and on the target cube imports this text file using a data rule file.
    The current problem I'm encountering is that it does not seem to be possible to limit down the transfer to a single period. In the report script, there's no issue because that is recognizing the server variable easily.
    But on the import side I have not found a method to have a single column dynamically writing into current period only. Is there no other option than someone going into this rules file and change the hardcoded fieldname each month?
    Thanks for any input
    Erik
    Belgium

    You can use substitution variables in version 9 of Essbase but not in earlier versions. Before v9 we'd get around this by using aliases e.g. CurrMonth. Each new month we'd move the alias to the next month.
    "But on the import side I have not found a method to have a single column dynamically writing into current period only"
    I'm assuming that you've created a text column here and filled it with a month value? It would be better to not have a month column and just set the month in the Header of the Data Load Settings.
    Hope this helps.
    Gee

  • Want to use presentation date variable in Advance SQL filter option

    Hi,
    I want to use presentation date variable in Advance SQL filter option.....I am getting the below error.
    SQL in Advance SQL filter ----
    "Fact Status Details"."Load Date" =
    (select min(Cast("D Time"."Business Date" as char))-1
    from "D Time" where "D Time"."Operational Month Sk" =
    (select "D Time"."Operational Month Sk" from "D Time" where date '@{Date1}'=cast("D Time"."Business Date" As char)))
    Error ---
    Error getting drill information: SELECT "Fact Status Details"."Load Date" saw_0 FROM "Pre RFAI Sales" WHERE "Fact Status Details"."Load Date" = (select min(Cast("D Time"."Business Date" as char))-1 from "D Time" where "D Time"."Operational Month Sk" = (select "D Time"."Operational Month Sk" from "D Time" where date '@{Date1}'=cast("D Time"."Business Date" As char)))
    Error Details
    Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <select>: Syntax error [nQSError: 26012] . (HY000)
    SQL Issued: {call NQSGetLevelDrillability('SELECT "Fact Status Details"."Load Date" saw_0 FROM "Pre RFAI Sales" WHERE "Fact Status Details"."Load Date" = (select min(Cast("D Time"."Business Date" as char))-1 from "D Time" where "D Time"."Operational Month Sk" = (select "D Time"."Operational Month Sk" from "D Time" where date ''@{Date1}''=cast("D Time"."Business Date" As char)))')}
    Load Date format ---YYYYMMDD
    Please advise...i need to fix this issue urgently.

    Thanks for your reply.
    Could you please help me with the correct code...i tried to correct it....
    "Fact Status Details"."Load Date" =
    (select Cast(min("D Time"."Business Date" )-1 as char)
    from "D Time" where "D Time"."Operational Month Sk" =
    (select "D Time"."Operational Month Sk" from "D Time" where Date'@{Date1}'=cast("D Time"."Business Date" As char)))
    Please let me know if i am wrong..this code is also not working.

  • Using variables in Caption section of Legend Answers view

    Is it possible to use variables as Captions in the Legend Answers view? If so, what's the format? Thank you

    Thank you for the link - i believe this is covered in docs, however, I wasn't able to get the result I wanted by using any of the variable strings. I'm just getting the string variable output along with my variable name. I should have mentioned that I've tried this before. You know which part I'm talking about right? When you go to Legend , then select caption. I still marked answer as helpful.

  • Using Variables in Meta Data

    One thing I loved about PhotoMechanic was the ability to use variables in a lot of the metadata info, IE date taken......

    Another vote for this excellent idea. I too use PhotoMechanic and will have to continue doing so because of the use of variables. If LR could give us that...
    For instance, PM automatically copies the filename to the Title field so that when I send images to my stock agency, I always have a reference as they change the filename to something that can be used in their system.
    Plus I copy location and date values to the caption field so that I only have to type a small description afterwards without having to type: "Paris (France); September 5, 2008."
    Simple things that are huge timesavers...

  • How to use the date repository variable in filter expression

    Hi Gurus
    I am getting error in using the date repository variable in Filter expression. I am using the below formula
    filter( Fact.calls USING  "Dim Time"."Fiscal Month End Date" = VALUEOF("month_start") )
    I am getting below error
    Formula syntax is invalid.
    [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 22024] A comparison is being carried out between non-compatible types. (HY000)
    SQL Issued: SELECT filter( fact.Calls using "Dim Time"."Fiscal Month End Date" =VALUEOF("month_start")) FROM "Call Data"
    Then i tryed the below format i am getting still the error
    filter( Fact.calls USING  "Dim Time"."Fiscal Month End Date" = DATE'(VALUEOF("month_start"))' )
    Formula syntax is invalid.
    [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 46047] Datetime value (VALUEOF("month_start")) from (VALUEOF("month_start")) does not match the specified format. (HY000)
    SQL Issued: SELECT filter( Fact.Calls using "Dim Time"."Fiscal Month End Date" =DATE'(VALUEOF("month_start"))') FROM "Call Data"
    Please let me know what i am missing or what is the correct syntax for fitler using the date repository variable.
    Thanks in advance
    Regards
    @li

    Hi @li,
    Syntax-1 is fine it will work,What kind of Variable is it?
    Static or Dynamic
    Thanks,

  • Syntax to export 18 months of data at any given time using variables?

    I have written a calculation script for exporting data from an application using DATAEXPORT. I want to get 18 months of data in my exported text files at any point of time. So, I want to specify the range using variables for Period and Year but I am kind of stuck on how should I be writing it in my script.
    Please let me know the correct syntax using variables or if you could share some link that would help me know that would be a help.
    Can I use @XRANGE Function???
    Thanks !

    Srinivas --> Thanks for clarifying that. After I read your post I did go through the @XRANGE again and noticed that they had use cross dimensional operators so it put me in a confusion. But you cleared it by being more specific this time. Thanks a lot !
    If I follow what Robb suggested then like you mentioned when 3 years will be involved its going to be difficult I guess. Not sure at this point which way would be the best to get this work.
    I agree with CL - 18 months rolling forecast can be annoying seriously.
    Can one of you please suggest me a permanent and most efficient solution for this out of all the ideas that would not require manual work and can be automated completely?
    Thank you all for your inputs. I really appreciate it.
    Edited by: 892254 on Nov 3, 2011 6:30 AM

  • Which BW variable is used for date(range) when creating a portal service

    Hi,
    Can any one please let me know which BW variable is to be used for date(range) when creating a portal service for searching based on dates.
    Thanks
    Abhai

    Hi Arun,
    its just a portal service which would be called when  searching a document created on a particular date or betwwen a range of date.so what i require is which BW variable to be used when handling range.As for variable technical name we use VAR_NAME_I  and for single value variable we VAR_VALUE_EXT_I
    in the similar manner i want BW variable to be used for range of values.
    Thanks
    Abhai

Maybe you are looking for

  • UTF/Japanese character set and my application

    Blankfellaws... a simple query about the internationalization of an enterprise application.. I have a considerably large application running as 4 layers.. namely.. 1) presentation layer - I have a servlet here 2) business layer - I have an EJB contai

  • Problem with model compilation

    Is it possible to create and compile model based on concat dimension? I try to do so model creates but when I try to compile such model, server closes connection. I use 10.2 Oracle

  • MSI 6368 with USB problem (URGENT)

    I have an urgent need to solve this problem. Client has a computer based on this motherboard, with Celeron 1.1 Ghz, WIN 98 Second Edition. The USB port works with a Microsoft mouse. Client tries to install a Canon digital camera (D60), but the USB po

  • Collecting or time based inbound idoc posting

    Dear All,   We have need of posting idoc's in a specific time interval in SAP ECC system. Please help us.   requirement is We are pushing idocs to ECC , but the idoc should get process only between 3 Pm to 6 PM. Kindly help us. Regards Pradeep P N

  • Elements 8 -help with outputting slide shows to File?

    Can anyone help with saving a slide show in created in Elements to a file on my laptop? I know a WMV file is created, which option should I select to save in UK widescreen format 16:9?