Declaring partition as a variable

Hi,
i have the following problem, I have a partitionate table and i want to use it in a procedure
these what i want to do
declare
p_data date;
v_part1 varchar2(50);
v_part1 varchar2(50);
cursor c1 is
select cam1,cam2,cam3....
from tabela1 partition (P010110) a,
tabela2 partition (P010210) b
where a.cam1 = b.cam1
and a.cam2 =p_data;
begin
p_data := to_date('31.03.2010','dd.mm.yyyy')
the problem it's i can declare the partition as a variable , to use automatically in procedure every month
I tried to declare partition as
select 'P'||to_char(p_data,'dd.mm.yy')
into V_part1
from dual
and i tried as
v_part1 := 'P'||to_char(p_data,'dd.mm.yy')
And the result while be
select camp1,camp2,camp3....
from tabela1 partition (V_part1) a,
tabela2 partition (P010210) b
where a.camp1 = b.camp1
and a.camp2 =p_data;
end everything i tried dose not work :(
end ideas

Your approach is wrong. Partitioning is a physical feature of the database. It has no place in SQL from the (logical) application layer.
Does the application layer know whether the table is a hash table or an index organised table? Perhaps a clustered table? No. There's absolutely no need for the application layer to know the physical storage structures used by the database. And partitioning is a physical storage structure feature.
Code plain normal application SQL - the Oracle CBO (Cost Based Optimiser) has all the intelligence and physical storage information required to make a proper decision on how to apply partition pruning+* to that application SQL.
* As Boneist suggested, read up on partition pruning to understand how to correctly and effectively use partitioning in Oracle

Similar Messages

  • How to specify XML declaration in an XML Variable

    I had posted this question in the Flex Builder discussion,
    but I am not sure if that was the right board, so posting it again
    here:
    I need to set the XML declaration for my XML variable as
    follows:
    var employees:XML =
    <?xml version="1.0" encoding="utf-8"?>
    <employees>
    <employee ssn="123-123-1234">
    <name first="John" last="Doe"/>
    <address>
    <street>11 Main St.</street>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>98765</zip>
    </address>
    </employee>
    <employee ssn="789-789-7890">
    <name first="Mary" last="Roe"/>
    <address>
    <street>99 Broad St.</street>
    <city>Newton</city>
    <state>MA</state>
    <zip>01234</zip>
    </address>
    </employee>
    </employees>;
    However, if I specify <?xml version="1.0"
    encoding="utf-8"?>, I get a design time and compile error. If I
    remove it it works fine. But the server to which I send this XML is
    expecting the declaration. How can I set the declaration?
    Any help or pointer is appreciated.

    I am not able to load the xml. Can anybody figure out the
    problem :
    I have used a LoadXML class :
    package {
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    // Demonstrates the code required to load external XML
    public class LoadXML extends Sprite {
    // The property that will eventually contain the loaded XML
    private var novel:XML;
    // The object used to load the XML
    private var urlLoader:URLLoader;
    // Constructor
    public function LoadXML () {
    // Specify the location of the external XML
    var urlRequest:URLRequest = new URLRequest("novel.xml");
    // Create an object that can load external text data
    urlLoader = new URLLoader();
    // Register to be notified when the XML finishes loading
    urlLoader.addEventListener(Event.COMPLETE,
    completeListener);
    // Load the XML
    urlLoader.load(urlRequest);
    // Method invoked automatically when the XML finishes
    loading
    private function completeListener(e:Event):void {
    // The string containing the loaded XML is stored in the
    URLLoader
    // object's data property (urlLoader.data). To create a new
    XML
    // instance from that loaded string, we pass it to the XML
    constructor
    novel = new XML(urlLoader.data);
    trace(novel.toXMLString()); // Display the loaded XML, now
    converted
    // to an XML object
    And in main.mxml :
    myXml = new LoadXml ;
    trace ( myXml.novel ) ;
    The output is errenous

  • How to specify the XML Declaration for an XML variable

    I need to set the XML declaration for my XML variable as
    follows:
    var employees:XML =
    <?xml version="1.0" encoding="utf-8"?>
    <employees>
    <employee ssn="123-123-1234">
    <name first="John" last="Doe"/>
    <address>
    <street>11 Main St.</street>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>98765</zip>
    </address>
    </employee>
    <employee ssn="789-789-7890">
    <name first="Mary" last="Roe"/>
    <address>
    <street>99 Broad St.</street>
    <city>Newton</city>
    <state>MA</state>
    <zip>01234</zip>
    </address>
    </employee>
    </employees>;
    However, if I specify <?xml version="1.0"
    encoding="utf-8"?>, I get a design time and compile error. If I
    remove it it works fine. But the server to which I send this XML is
    expecting the declaration. Can somebody help me with this?
    Thanks

    I work mostly with the Java versions of the parser so you'll have to make the translation to C++. As far as I know, you can't use the SAX API to access to the encoding.
    You need to use the DOM along with Oracle's extension to the basic DOM functionality. Oracle's package, oracle.xml.parser.v2 defines a class which implements the Document interface called XMLDocument. This class has a method, getEncoding(), which returns the encoding. You would use the method in getDocument() in the Parser base class inherited by DOMParser to retrive the XMLDocument.
    Jeff

  • How to declare a global/public variable in Oracle Forms

    Hi All,
    I have to get the value of a variable which is declared in the event 'When_Button_Pressed', in an another trigger with in the form.
    My variable & type
    l_db_handle EXEC_SQL.ConnType;
    This variable used to get the handle of a new database connection.
    (Here I am trying to make connection to two different databases from Form. That is working fine.)
    I have tried with Global variable to transfer this variable value to other triggers. But it is not working. It shows 'Wrong type error'
    Could you please let me know, how can I declare which DB handle variable as public in form(I mean i have to use this variable all the triggers with in the form)
    Thanking You,
    Manu

    Put the code in a package within the form, have the triggers call functions/procedures within the package. All variables which need to be referenced in more than one procedure can be created as package variables.

  • Declare field as a variable in SQL

    I decalred one field as a variable and i am trying to execute the query. but it throwing error. what is the correct way to pass the variable.
    Msg 170, Level 15, State 1, Line 3
    Line 3: Incorrect syntax near 'g'.
    declare
    @Query
    as
    varchar(3000),
    @price_type
    as
    varchar(50)
    set
    @price_type =
    'g.nHighPrice'
    set
    @Query =
    'SELECT top 2 g.tPriceDescID as price_desc_id , e.tName as price_type_name
           ,g.tEffectiveDate as effective_date '
    + @price_type+'
           ,g.nMidPrice as mid_price, a.tpricename as price_comment
           ,g.nPostingPrice  as posting_price
           FROM  MdPriceDesc a
          inner join  Company b on a.yPublishCompanyID=b.yOid
          inner join Commodity c on a.yPublishCommodityID = c.yOid
          inner join Location d on a.yLocationID=d.yOid
          inner join MdPriceType e on a.yPriceTypeID = e.yOid
    inner join MDR.dbo.MdPriceDetail g on g.tPriceDescID=a.tPriceDescID
    execute(@Query)

    There is an error with your script..
    @Query =
    'SELECT top 2 g.tPriceDescID as price_desc_id , e.tName as price_type_name
           ,g.tEffectiveDate as effective_date '
    + @price_type+'
    you are missing a comma (,) '...as effective_date, '
    Please click "Mark As Answer" if my post helped. Tony C.

  • How to declare and use a variable in BI Publisher report

    Hi Experts ,
    I have to groups of serial numbers and both group are put in same table and same row one after another , and i have a condition that if no serial number is present in both group than the line of that table should not be appeared ,i used the condition region ,biut this condition region is working in single group case if i put both groups together ,the blaing line appears with its label ,I think if i will have have variable which can count the total present of serial number than I cant put a single condition ,would you please help me ,how can I declare a variable and how can i count the number of serials in both groups ,please find below the example
    <grp1><?SR_NUM1?><end of grp1> <grp2><?SR_NUM2?><end of grp2>
    above example is how i am printing now ,now i need a combined condition where if bot group do not contain any value then this blank line should not appear . thanks in advance.
    Thanks
    Pratap

    Hi ,
    Decalring the Varible :
    <?xdoxslt:set_variable($_XDOCTX, 'var', 0)?>
    Do the calculation :
    <?xdoxslt:set_variable($_XDOCTX,'var', xdoxslt:get_variable($_XDOCTX,'var‘)+ XML columnname)?>
    Display the Variable :
    <?xdoxslt:get_variable($_XDOCTX, 'var')?>
    Declare the varaible before your loop starts.Do the calculation part inside the loop so for each row it will be updated.
    Display the results where you want using the form field and place the display varaible syntax.
    Hope this will helpful for you.
    Thanks,
    Ananth

  • How to declare and read a variable more than 255 characters

    Hi Friends,
          Actually i want to declare a variable which can accepts more than 255 characters as input and the same manner i want to read the data and pass the data as a output length more than 255 characters.
      So how can i delcare the data as a field in the table.
    Thanks & Regards
    Gupta

    Hi Raj,
       Thanks for your reply, please privide the further clarification actually by declaring a variable as string i can able to pass 1023 characters form selection screen like that i passed the data to the three varibles and i concatenated those three varibles in to single varible now is there any way to pass the result into the smartform.
      Please give me some techincal stuff on this
    Regards
    Gupta

  • Pb to setup replicated partition with substitution variables

    Dear all,
    I have the following problem with the replicated partition by using the substitution variables :
    I would like to create a replicated partition using 3 substitution variables: &CurrPeriod, &CurrWeek, &CurrYear. The goal of this is to be able to copy data from application SourceApp to TargetApp every week, by changing the subst variables.
    The script I have created is :
    login useradmin identified by password on EssbServer
    alter application SourceApp load database SourceDb
    alter application TargetApp load database TargetDb
    create or replace replicated partition SourceApp.SourceDb
    Area ' "Account1", &CurrPeriod, &CurrWeek, &CurrYear, "ND_DISTRI","ND_PAGE","ND_PROD","VT", "REEL", "EUR" ' SourceArea
    to TargetApp.TargetDb at EssbServer  as useradmin identified by password
    Area ' "Account1",    "M_N",     "S_N",     "FY1" , "ND_DISTRI","ND_PAGE","ND_PROD","VT", "REEL", "EUR" ' TargetArea
    +     mapped TargetArea ("&CurrYear") to ("FY1")+
    +     mapped TargetArea ("&CurrWeek") to ("S_N")+
    +     mapped TargetArea ("&CurrPeriod") to ("M_N")+
    +     update allow;+
    refresh replicated partition SourceApp .SourceDb to TargetApp .TargetDb at EssbServer all data ;
    The issue is that this is not working. I don’t see any data when launching the Maxl script even if the script syntax is validated by essbase. The very strange thing is that when I replace the substitution variable by members, this script works fine, I see my data in the target cube. For example if I replace the subst variables by
    Area ' "Account1", “Month1”, “Week1”, “Year1”, "ND_DISTRI","ND_PAGE","ND_PROD","VT", "REEL", "EUR" ' SourceArea
    to TargetApp.TargetDb at EssbServer  as useradmin identified by password
    Area ' "Account1",    "M_N",     "S_N",     "FY1" , "ND_DISTRI","ND_PAGE","ND_PROD","VT", "REEL", "EUR" ' TargetArea
    +     mapped TargetArea (“Year1”) to ("FY1")+
    +     mapped TargetArea (“Week1”) to ("S_N")+
    +     mapped TargetArea (“Month1”) to ("M_N")+
    So my conclusion is that there is something wrong with the syntax of the substitution variable in my mapping.
    Your help on this would be very appreciated .

    Hi,
    I have the answer from Oracle support :
    Hello,
    This is a known bug.
    BUG 7418041
    This has been documented as a known issue in Essbase Release 9.3.1.3 with the following description: "Partitioning. Using substitution variables in replicated partition mappings incorrectly prevents data from replicating. [7418041]"
    Currently the development team are working on a fix, but we don't have a release date yet.
    The suggested workarounds are to use member names (which you have confirmed work) or use a Transparent partition in place of a replicated partition.

  • How to declare java.lang.Class variable that can be used in Enum.valueOf(.)

    As per subject -- we have a need to declare variable in class that will hold enum's Class object. At some point we want to use this variable as a Class argument for Enum.valueOf(.) which has the following signature:
    public static <T extends Enum<T>> T valueOf(Class<T> enumType, String name) {..}So far we cannot come up with a workable solution.
    private final Class<? extends Enum<?>> propertyClass;doesn't work (apparently because second ? should in fact be the same as first ? -- which works with T for class/method templates, but cannot be used for variables). Error message (in Eclipse) is:
    Bound mismatch: The generic method valueOf(Class<T>, String) of type Enum<E> is not applicable for the arguments (Class<capture#13-of ? extends Enum<?>>, String). The inferred type capture#13-of ? extends Enum<?> is not a valid substitute for the bounded parameter <T extends Enum<T>>
    So what would be the proper way to declare the variable?
    Thanks in advance!

    the enum.valueof method is a little weird. they implemented it so it is nice and "safe". if you don't care about that safety, you can probably work with raw types for that bit of code and get the call to go through. you just won't have any type safety on the result.

  • Declaring public static final variables in jsp?

    The question is in the title...
    I know this is not a jsp forum, but some people here might know if it's possible or not.
    If yes, how to declare them and how to access them from other jsp pages?
    Thx

    If you need that, you definitely do too much work in your JSPs. You should do all your work in Servlets (or Actions if you're using Struts or something similar).
    Your JSPs should only do the presentation.
    Remember that JSPs are not classes (they are compiled into classes internally, but you don't have direct access to those).
    If you absolutely need such a public static final field that you want to access from several JSPs, just define it in a Class and reference that class from your JSPs.

  • How do you declare on A class' variables as public?

     

    simply by puttin gpublic in front of it eg a variable
    int z = 6;this would be
    public int z = 6;

  • How to declare variable in an application

    I want to declare a pl sql variable in an application(form, report...)without editing the package code.
    Thanks
    null

    Thanks for information.
    Actually still I have a doubt which one is the best. And which way is the easiest way. Can you give a more explanation for me.
    I start to read about Log4J, and here is one of link I refer.
    [http://supportweb.cs.bham.ac.uk/docs/tutorials/docsystem/build/tutorials/log4j/log4j.html]
    My question on that is, on a text file I can do it, on Windows. But in Linux, Mac and so on. Please instruct me. I've never done such things before.

  • Bind Variable popup when no bind variable declared

    I am writing a fairly complex SQL (FYI, I want to keep this all in one step and not split out with multiple sub-selects) and I am getting the bind variable popup and an error message ("The requested URL /apex/wwv_flow.show was not found on this server ") and I am not sure why and could definitely use some help. From what I see there is no issue with the SQL syntax written and when I try to break it down, everything goes well until the point where I write a case statement with an OR and checking for 'BLOCK'.
    The issue comes when using the bolded line.
    I am using "10g Release 2 (10.2)" and querying from the SQL commands area inside it.
    The goal is to identify the area of the court broken down by the x and y dimension, home and away team has different logic to be used and if it is a block there is different logic.
    Your help would be greatly appreciated, and I am leaning towards it is a bug in the SQL Commands section of the tool:
    The full query is below:
    case when E.YEAR IS NOT NULL then
    *(case when x_dimension < 12.5 then 'A' when x_dimension <= 25 then 'B' when x_dimension < 37.5 then 'C' else 'D' end ||*
    case when ((a.action_team=c.awayname3 and A.ACTION_TYPE = 'BLOCK') or (a.action_team=c.homename3 and A.ACTION_TYPE <> 'BLOCK')) then (case when y_dimension < 9.5 then '4' when y_dimension <= 19 then '3' when y_dimension < 28.5 then '2' when y_dimension <= 38 then '1' else '0' end) else (case when y_dimension > 84.5 then '4' when y_dimension >= 75 then '3' when y_dimension < 65.5 then '2' when y_dimension <= 56 then '1' else '0' end) end) else 'NA' end as COURT_LOC
    It would not allow to enter the full SQL but please know that there is no issue with any declaration of the columns.
    Edited by: user10615520 on Feb 29, 2012 10:29 AM
    It seems that it is an issue with the in house SQL client of XE as I downloaded SQL Developer and ran same query there and the result was no issues. Is anyone aware of a bug for something like this?
    Edited by: user10615520 on Feb 29, 2012 10:43 AM

    So I am running Oracle Database Express version 10g. When you login through the default web interface, there is a SQL command line option. When I utilize the SQL below, can't insert whole SQL statement for some reason it won't let me, in that SQL command line I get a pop up window asking about values for bind variables... But as you can see from the code below there is no declaration of a bind variable. I also get the error message from the original post.
    When I use the same query in Oracle SQL Developer, not express (mistake in previous note), the query runs without any issues.
    My question is if anyone is aware of the oracle database express sql command line module having a bug where this is occurring. When I remove the line below from the query it runs fine in the Oracle Database Express command line module.
    Thank you for your help, I hope this is clear.
    case when E.YEAR IS NOT NULL then
    (case when x_dimension < 12.5 then 'A' when x_dimension <= 25 then 'B' when x_dimension < 37.5 then 'C' else 'D' end ||
    case when ((a.action_team=c.awayname3 and A.ACTION_TYPE = 'BLOCK') or (a.action_team=c.homename3 and A.ACTION_TYPE <> 'BLOCK'))
    then
    (case when y_dimension < 9.5 then '4' when y_dimension <= 19 then '3' when y_dimension < 28.5 then '2' when y_dimension <= 38 then '1' else '0' end)
    else
    (case when y_dimension > 84.5 then '4' when y_dimension >= 75 then '3' when y_dimension < 65.5 then '2' when y_dimension <= 56 then '1' else '0' end)
    end) else 'NA' end as COURT_LOC

  • Package variable declaration

    I need to declare Item_To_Go_To package level variable stored in the Instace package for the below code.
    I have create a a package specification in the form as a Program Unit named "Instance".
    Now i need to declare Item_To_Go_To variable which will store control name like
    Instance.Item_To_Go_To := 'myblock.myitem';
    I have controls like text item, list item, Checkbox. How to declare these variables?
    I have used the below one:
    PACKAGE Instance IS
    Item_To_Go_To item;
    END;
    In my example Instance.Item_To_Go_To := 'User.FIRST_NAME';
    is giving expression is a wrong type error. Please let me know what i have done wrong.
    I have used timer expired trigger to overcome my illegal restricted procedure Go_item issue.
    Code snippet.
    Declare
    htimer Timer;
    Begin
    Instance.Item_To_Go_To := 'myblock.myitem';
    Create_Timer( 'wvi_nav_timer', 1, NO_REPEAT);
    End;
    Then in the When-Timer-Expired trigger...
    Begin
    If ( Get_Application_Property( Timer_Name ) = 'wvi_nav_time' ) Then
    Go_Item( Instance.Item_To_Go_To );
    End If;
    End;
    Please refer:
    Alternative trigger like post_change but can 'go_item'
    Edited by: Chris90909 on Jun 12, 2009 12:27 PM

    As you are trying to assign a varchar-value to the variable, you should declare it as varchar2 like:
    PACKAGE Instance IS
      Item_To_Go_To VARCHAR2(61);
    END;

  • Simple command to refresh data of all declared internal tables & variables!

    Hi All,
    I have declared many internal tables & variables in my program in declaration include.
    Is there any Simple command which can refresh data of all declared internal tables & variables!
    Instead of clearing & refreshing each i.table & variable i want to use single command to refresh data.
    Is this possible!
    Thanks in advance.
    Thanks,
    Deep.

    CLEAR: lv_field1,
                 lv_field2,
                 lt_itab1[],
                 lt_itab2[].
    ONE simple command (CLEAR), can initialize fields, workareas, field-symbols,.... and internal tables.

Maybe you are looking for

  • XML Publisher Template Builder for Adobe Acrobat

    Need a XML Publisher Template Builder for adobe acrobat as is available for word.

  • Skillbuilder Modal Page: Popup to close on session time out

    Hi All, I implemented skillbuilder modal page plug-in in my application. When a session expires, the Popup window remains open and in the same popup window current page gets redirected to login page. I want popup window to close so that users can log

  • Common Error Mesg Frustrating

    hi,new to java,soplease be patient: 1) I've installed jdk1.6 on c drive in a folder named java 2) I've also saved the "HelloWorldApp.java" text file in the same folder 3) Now I try to run with C:\java\jdk1.6.0_10\bin\javac HelloWorldApp.java at the c

  • Sequencing of tasks in STS

    Hi,   We are on BI 7.0 and are implementing Integrated Planning. We have set up the Status Tracking System. It works fine. However, within a particular node in the STS, there are 5 Web Templates assigned and these have to be executed in a sequence du

  • Export illustrator file from Flash Professional CS6

    Can a background/scene created in Flash profession be exported to illustrator file with extension Ai without illustrator?