How to change the tablename at runtime?

Hi
IN _10gR2_
I would like to know if there is a way to change the tablename at runtime - other than using dynamic sql.
These table have similar structure except the tablename iteself.
For ex. depending on where we get a request we want to look/update different table:
if request_from x then
select * from table where ....
or it could be update or insert statement here
end if;
if request from y then
select * from table_y where ....
or it could be update or insert statement here
end if;
Thanks

user565033 wrote:
sorry, this is not an optionWell the best you'll get is something like...
SQL> select * from emp;
     EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO
      7369 SMITH      CLERK           7902 17-DEC-1980        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-1981       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-1981       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-1981       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-1981       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-1981       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-1981       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-1987       3000                    20
      7839 KING       PRESIDENT            17-NOV-1981       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-1981       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-1987       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-1981        950                    30
      7902 FORD       ANALYST         7566 03-DEC-1981       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-1982       1300                    10
14 rows selected.
SQL> select * from emp2;
     EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO
      7369 SMITH      CLERK           7902 17-DEC-1980          0                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-1981          0        300         30
      7521 WARD       SALESMAN        7698 22-FEB-1981          0        500         30
      7566 JONES      MANAGER         7839 02-APR-1981          0                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-1981          0       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-1981          0                    30
      7782 CLARK      MANAGER         7839 09-JUN-1981          0                    10
      7788 SCOTT      ANALYST         7566 19-APR-1987          0                    20
      7839 KING       PRESIDENT            17-NOV-1981          0                    10
      7844 TURNER     SALESMAN        7698 08-SEP-1981          0          0         30
      7876 ADAMS      CLERK           7788 23-MAY-1987          0                    20
      7900 JAMES      CLERK           7698 03-DEC-1981          0                    30
      7902 FORD       ANALYST         7566 03-DEC-1981          0                    20
      7934 MILLER     CLERK           7782 23-JAN-1982          0                    10
14 rows selected.
SQL> with req as (select &required_table as req from dual)
  2  --
  3  select * from emp, req where req = 1 union all
  4  select * from emp2, req where req = 2
  5  /
Enter value for required_table: 1
old   1: with req as (select &required_table as req from dual)
new   1: with req as (select 1 as req from dual)
     EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO        REQ
      7369 SMITH      CLERK           7902 17-DEC-1980        800                    20          1
      7499 ALLEN      SALESMAN        7698 20-FEB-1981       1600        300         30          1
      7521 WARD       SALESMAN        7698 22-FEB-1981       1250        500         30          1
      7566 JONES      MANAGER         7839 02-APR-1981       2975                    20          1
      7654 MARTIN     SALESMAN        7698 28-SEP-1981       1250       1400         30          1
      7698 BLAKE      MANAGER         7839 01-MAY-1981       2850                    30          1
      7782 CLARK      MANAGER         7839 09-JUN-1981       2450                    10          1
      7788 SCOTT      ANALYST         7566 19-APR-1987       3000                    20          1
      7839 KING       PRESIDENT            17-NOV-1981       5000                    10          1
      7844 TURNER     SALESMAN        7698 08-SEP-1981       1500          0         30          1
      7876 ADAMS      CLERK           7788 23-MAY-1987       1100                    20          1
      7900 JAMES      CLERK           7698 03-DEC-1981        950                    30          1
      7902 FORD       ANALYST         7566 03-DEC-1981       3000                    20          1
      7934 MILLER     CLERK           7782 23-JAN-1982       1300                    10          1
14 rows selected.
SQL> /
Enter value for required_table: 2
old   1: with req as (select &required_table as req from dual)
new   1: with req as (select 2 as req from dual)
     EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO        REQ
      7369 SMITH      CLERK           7902 17-DEC-1980          0                    20          2
      7499 ALLEN      SALESMAN        7698 20-FEB-1981          0        300         30          2
      7521 WARD       SALESMAN        7698 22-FEB-1981          0        500         30          2
      7566 JONES      MANAGER         7839 02-APR-1981          0                    20          2
      7654 MARTIN     SALESMAN        7698 28-SEP-1981          0       1400         30          2
      7698 BLAKE      MANAGER         7839 01-MAY-1981          0                    30          2
      7782 CLARK      MANAGER         7839 09-JUN-1981          0                    10          2
      7788 SCOTT      ANALYST         7566 19-APR-1987          0                    20          2
      7839 KING       PRESIDENT            17-NOV-1981          0                    10          2
      7844 TURNER     SALESMAN        7698 08-SEP-1981          0          0         30          2
      7876 ADAMS      CLERK           7788 23-MAY-1987          0                    20          2
      7900 JAMES      CLERK           7698 03-DEC-1981          0                    30          2
      7902 FORD       ANALYST         7566 03-DEC-1981          0                    20          2
      7934 MILLER     CLERK           7782 23-JAN-1982          0                    10          2
14 rows selected.
SQL>Otherwise you'll have to perhaps use a few "alter table rename..." ddl's to switch the table names around prior to your query.

Similar Messages

  • How to change the "name of column" property of an text item in runtime?

    How to change the "name of column" property of an text item in runtime?
    I look the properties of items in help and found nothing about this!
    It's possible?

    Hi,
    an other solution is change the block property QUERY_DATA_SOURCE_TYPE from "Table" to "Sub-query" , than change at run time the property QUERY_DATA_SOURCE_NAME.
    First create block and add items
    The QUERY_DATA_SOURCE_NAME will be for ex. "Select 'A' as col1, 'B' AS col2, 'C' as col3 from dual"
    Set into items the column name property to col1 , col2 ...
    At run time change the query to "Select 'Z' as col1, 'X' as col2 , 'Y' as col3 from dual"
    in this way you can change the source of column value.
    Caution because if you change value type from varchar2 to date you must cast date into varchar2.
    May be that this way is valid only for view data not for insert-update, i don't remember.
    bye
    Message was edited by:
    Killernero

  • How to change the Task title on runtime?

    Hi experts again,
    My customer is struggling with something very simple: how to customize the Task title. You can certainly create an argument in the task, use Data Associations to map the argument, and then use XPath expression to get the value from the task payload and set it to the task title. That works fine. But it only executes once, when the process instance 'enters' in the task.
    So once the Task is created, you can see the custom title in the Workspace.
    Now, can we change the Title on runtime? I thought you could get the task payload, update the title and finally update the task but this does not seem to work. Here's the code that does it.
    In this example, the priority is updated successfully but not the title.
    FacesContext context = FacesContext.getCurrentInstance();
    String tskId = (String)context.getApplication().evaluateExpressionGet(context,
    "#{pageFlowScope.bpmWorklistTaskId}", String.class);
    IWorkflowServiceClient workflowSvcClient = WorkflowService.getWorkflowServiceClient();
    ITaskService taskSvc = workflowSvcClient .getTaskService();
    ITaskQueryService wfQueryService = workflowSvcClient.getTaskQueryService();
    IWorkflowContext wfContext = WorklistUtil.getWorkflowContextForASelectedTask();
    Task myTask;
    try {
    myTask = wfQueryService.getTaskDetailsById(wfContext, tskId);
    Element payloadElem = myTask.getPayloadAsElement();
    System.out.println("****************" + myTask.getTitle());
    System.out.println("****************" + myTask.getPriority());
    myTask.setTitle("Task Title 3");
    myTask.setPriority(2);
    myTask.setPayloadAsElement(payloadElem);
    taskSvc.updateTask(wfContext, myTask);
    } catch (Exception e) {
    e.printStackTrace();
    The results which printed out in console after execute above code twice.
    ****************Task Title 1
    ****************3
    ****************Task Title 1
    ****************2

    You can use the appropriately named Window Title property. In your project you can define conditional disable symbols (right-click on the project node and select Properties) and then use a conditional disable structure in your code. However, these symbols apply to the entire project, not to a specific executable. Thus, a better route would be to use the executable name (also accessible via a property), if possible, or some other distinction between the executables. What makes the executables different?

  • How to change the default language of form9i?

    How to change the default language of form9i? For example, change the language from Spanish to English.
    Regards!
    Gerald

    Hi,
    set the NLS_LANG parameter and make sure the language supplement classes got installed when installing the deesigntime or server. If you need to change the language for runtime, set the value in the default.env file - assuming its a web based appication
    Frank

  • How to change the font size and style on run time

    dear all
    i try to change the font style and font size on runtime. I did the following:
    1- i created an item(:font_size) in which i will write the size of the font for the the other item ('customer_name')
    2 on the post_change trigger for 'font_size' i write this code
    SET_ITEM_PROPERTY('customer_name',FONT_size,(:font_size);
    i write 12 then then font size changed , then i write 18 , the size does not change. and when i write any value , no change happens. I do not know why
    the second problem is how to change the font style
    i made three checkbooks (bold,italic,underline)
    on the trugger when_checkbox_checked i write
         IF :BOLD = 'B' THEN
         SET_ITEM_PROPERTY('N_SAMPLE',FONT_STYLE,'BOLD');
         ELSE
    SET_ITEM_PROPERTY('N_SAMPLE',FONT_STYLE,'REGULAR');
         END IF;     
    no change happend at all.
    please help

    Hi friend,
    it's a really really strange tip... May be it's a Forms bug? I've tried with set_item_property..and.. you're right, it doesn't work..
    So.. you can try making this:
    - create a visual attribute with an specific font size....
    - use the
    SET_ITEM_INSTANCE_PROPERTY('block.item',CURRENT_RECORD,VISUAL_ATTRIBUTE,'you_visual_attribute');
    and call it from psot-change....
    It works
    Hope it helps,
    Jose.

  • How to change the endpoint url of the siebel service ?

    Hi All,
    JDev : 11.1.1.5
    I am fetching data from the siebel webservice. I created the proxy client from the Siebel WSDL in the JDeveloper. It was working fine.
    Now the endpoint URL(Server) is changed. This service fails to connect to that server. The service name is same.
    I want to fetch the end point urls from a property file, so that, even again if the server is changed, i have to change it in my property file.
    How to change the End point URL at runtime before calling the service ?
    This is my endpoint URL.
    http://oa8181.us.oracle.com:10800/eai_enu/start.swe/#%7Bhttp%3A%2F%2Fpolicing.oracle.com%2F%7DPolicing_spcQuery_spcIncidents_spcWF?wsdl?SWEExtSource=WebService&SWEExtCmd=Execute&UserName=AUSTINP&Password=AUSTINP
    Now it is pointing to this
    http://oa8023.us.oracle.com:7777/eai_enu/start.swe/#%7Bhttp%3A%2F%2Fpolicing.oracle.com%2F%7DPolicing_spcQuery_spcIncidents_spcWF?wsdl?SWEExtSource=WebService&SWEExtCmd=Execute&UserName=AUSTINP&Password=AUSTINP
    Give me some solution.

    See if this helps:
    http://kingsfleet.blogspot.co.uk/2008/12/controlling-what-service-proxy-uses-at.html

  • How to change the text of label dynamically

    Hi all,
    I have done a dynpro program.It requires to implement the dynamically display the label text, for example: there is a label, sometimes, we want to display "Purchase Order" and sometimes we want to display "Sales Order". Can anyone tell me how to change the text of label according to my requirements? thanks in advance!

    Hi Wei,
    AS of now you will not be able to change the Text Field ( Label ) dynamically or at runtime. This is a limitation.Refer to this link:
    http://help.sap.com/saphelp_nw04/helpdata/en/e4/2adbef449911d1949c0000e8353423/frameset.htm
    But, there is a way around.
    You can make a text field Visible / Invisible based on your program logic. So, based on what you want, you can process a module which will take care of that.
    Have a look at these DEMO Code. You can have a good idea to implement the logic.
    DEMO_DYNPRO_MODIFY_SCREEN - Demonstration of Dynamic Screen Modifications
    Thanks,
    Samantak.

  • How to change the Schema (DB2, Oracle) in CommandTable at run time

    Dear all,
    I have a problem as below:
    I have created report with CommandTable, then I am using Java and CRJ 12 to export data. So how to change the SCHEMA in CommandTable? 
    Please help me on this.
    Ex: CommandTable is SELECT * from SCHEMA.TableA, SCHEMA.TableB
    Thanks,
    Nha

    Dear Ted,
    I want to change DataSource, it means the report will be load and change connection at run time (using CRJ SDK) and i want to change the SCHEMA.Tablename in CommandTable in report.
    I also use the parameter to do it, but it can not be at run time, just correct when designing.
    Could you please help me on this. You can post the code if any.
    Thanks,
    Nha

  • How to change the phase by 90 deg of a sine wave

    Hi
    Does any one know how to change the phase of a sine wave by 90 degrees.
    Mal

    Hi Malkoba,
    Thank you for your post.
    Having looked at your VI I can say that you have created the correct inputs to the 'Sine Waveform.vi'.
    However the dial you had created had no affect as it was not wired into it the 'Sine Waveform.vi' on the block diagram.To fix the problem I have wired the 'Phase' dial into the 'phase' terminal of the waveform generator. This now changes the phase of the sine wave during runtime.
    The dial also now has a digital display (numeric box below it)- this can be used to read the dial's value, or feed in specific values into the control.
    Please find a modified version of your VI below.
    Regards,
    Field Sales Engineer | National Instruments | UK & Ireland
    Attachments:
    NI_phase shift sine.vi ‏31 KB

  • How to change the format of an in build date

    How to change the inbuild date datatype format?

    Hi Renuka,
    Follow these steps:
    1. Create a context attribute named date1
    2. create a simple type (local Dictionary-->simpletype) named date1 of type date.
    3. If you want your date format to be same always and doesn't require to change dynamically then go to representation tab for your simple type (date1) and set its format to dd/MM/yyyy(eg.)
    4. For your context date1 set it type property to your simple type(using browse button ...)
    5. Bind this context to a input field in your view
    If you want to change the format of your date at runtime then you need to write this code in the method where you would like to change its format.
    IWDAttributeInfo attr = wdContext.getNodeInfo().getAttribute("date1");
    ISimpleTypeModifiable simple = attr.getModifiableSimpleType();
    simple.setFormat("dd/MM/yyyy");
    Regards,
    Murtuza

  • How to update the ItemRenderer at runtime..?

    Hi....
    am facing a hectic problem with ITemRenderes..
    My requirement is like i need to insert a Label and Image in
    each item of Horizontal List.
    For this i created a ArrayCollection with Lable and
    ImagePath. And assigning array as a Dataprovider to HorizontalList.
    and am attaching itemrenderer to it (which hold the lable and
    image).
    code:
    var data:ArrayCollection=new ArrayCollection({label:'A',
    path:'a.jpg'}, {label:'B', path:'b.jpg'}{label:'C', path:'c.jpg'});
    var hList:HorizontalList=new HorizontalList();
    hList.dataProvider=data;
    hList.itemRenderer=new ClassFactory(rendererObj);
    rendererObj holds the Lable Component and Image Componnet..
    Now the porblem is am trying to change the horizontal list at
    runtime. Like i want to change the lable of selected item in
    Horizontal list. Am able to update the arraycollection values. But
    its not getting effected in ItemRenderer.
    How to update the itemerenderer at runtime...?
    Thanks in Advance...
    Pratap

    Hi Pratap,
    I was playing with some sample code for this...
    Here is the main.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.utils.ArrayUtil;
    import mx.collections.ArrayCollection;
    import mx.collections.IViewCursor;
    import mx.controls.Alert;
    import mx.events.*;
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.listClasses.BaseListData;
    import mx.controls.HorizontalList;
    import mx.controls.dataGridClasses.DataGridColumn;
    import mx.containers.TitleWindow;
    [Bindable] private var myItemRenderer:ClassFactory;
    private function doit()
    myItemRenderer = new ClassFactory(rendererObj);
    var mydata:ArrayCollection=new
    ArrayCollection([{mylabel:'A', path:'a.jpg'}, {mylabel:'B',
    path:'b.jpg'},{mylabel:'C', path:'c.jpg'}]);
    var myList:HorizontalList = new HorizontalList();
    myList.dataProvider = mydata;
    this.addChild(myList);
    myList.itemRenderer=myItemRenderer;
    ]]>
    </mx:Script>
    <mx:Button x="204" y="191" label="Button"
    click="doit()"/>
    </mx:Application>
    Here is the rendererObj.mxml (component/itemrenderer)
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="110" height="76"
    implements="mx.core.IFactory,mx.controls.listClasses.IDropInListItemRenderer"
    backgroundColor="#BAB3B3" borderStyle="solid" borderThickness="3"
    borderColor="#000000">
    <mx:Script>
    <![CDATA[
    import mx.collections.IViewCursor;
    import mx.controls.listClasses.BaseListData;
    import mx.controls.Label;
    private var _listData:BaseListData;
    public function newInstance():*
    return new rendererObj();
    public function get listData() : BaseListData
    return _listData;
    public function set listData( value:BaseListData ) : void
    _listData = value;
    override public function set data(value:Object):void {
    if (value != null)
    var r:Label = new Label();
    r.text = value.mylabel;
    this.addChild(r);
    ]]>
    </mx:Script>
    </mx:VBox>
    See how that works..you press the button and the itemrenderer
    gets drawn into the horiz. list with the values from the
    arraycollection.
    I didnt implement the picture, but you get the idea on how to
    get
    the values into the hlist..
    hope this helps...

  • How to change Text2D color at runtime...

    Hi,
    In fact I used Text3D and I was able to change color, text, font, style at runtime. I don't know if you guys have the same problem but Text3D doesn't render correctly (some letters are hidden by others) (i'm on a SGI Irix).
    So I decided to go back to Text2D but I can't find how to change the color, text, font and style at runtime.
    I've a Shape3D instance myShape = new Text2D(someParams);
    When I want to change it I tried myShape = new Text2D(otherParams);
    But nothing happened...
    I've tried detaching the shape, modify it, and re-add it to the graph, but it is still the same after adding it...
    If someone could tell me how I can do that it would be a great help.
    thank you
    Fred

    http://forum.java.sun.com/thread.jsp?forum=21&thread=356750

  • How to change the OraSSO login link in webcache/load balance

    Hi
    we have 10gAsR1 installed as a Portal instance. We have 6-server
    load balancer => webcache as loadbalancer (listening port 80)
    Wb ch1 and wb ch2 => webcache (listening port 7777)
    portal1 and portal2 => Portal listening 7778
    infra =>Infrastruture with repository Portal/Oracle SSO (listening 7777)
    This set up is working fine for our intranet setup, now we need to open this for couple of external clients. Well initially we need to open on the load balancer server on port 80 for external team to access, it works fine when we make it publc access.
    Now when we need to make it SSO (siteminder) enables, when users click on login link it first goes oracle sso then it internally redirects the page to site minder sso.
    Well, I have noted that the sso server details are mentioned in global setting sso/oid details. Since we need to open this for external client we have to add a DNS entry for this so that we can allow its access over firewall..
    Now I have made DNS name change at my infrserver level, now I need to update the change at the load balancer server (where wheb chache is running).
    Any one know how to chang the URL at load balancer.
    I am struck at this point please suggest how should i proceed..
    Thanks,

    Extract from Personalization Guide - Page Footer - Personalization Considerations
    * If you wish to personalize the URL that points to the Privacy Statement for a page that displays a standard Copyright and Privacy (that is, its Auto Footer property is set to true), set the Scope to OA Footer, in the Choose Personalization Context page of the Personalization UI.
    * If you wish to personalize the URL that points to the Privacy Statement for a page that displays a custom Copyright and Privacy (that is, its Auto Footer property is set to false), set the Scope to Page in the Choose Personalization Context page of the Personalization UI. In the following Page Hierarchy Personalization page , identify and personalize the Privacy page element.

  • How to change the privacy statement link url

    I looked into the previous threads , could not find the answer to "Changing the privacy statement url to clients privacy statement url".
    I am talking about the privacy statement URL in the page that user see it as soon as user logs into the e-business suite.
    I have read the previous theads and developers guide regading how to show or hide this autofooter thing. but could not find any thing about how to change the one in the login page.I even looked ino personalization but could not find a place to change this url. please HELP.
    Another question is " is it ok to show privacy statement in just the first page and hide it in rest of the application pages?"
    Thanks
    karan

    Extract from Personalization Guide - Page Footer - Personalization Considerations
    * If you wish to personalize the URL that points to the Privacy Statement for a page that displays a standard Copyright and Privacy (that is, its Auto Footer property is set to true), set the Scope to OA Footer, in the Choose Personalization Context page of the Personalization UI.
    * If you wish to personalize the URL that points to the Privacy Statement for a page that displays a custom Copyright and Privacy (that is, its Auto Footer property is set to false), set the Scope to Page in the Choose Personalization Context page of the Personalization UI. In the following Page Hierarchy Personalization page , identify and personalize the Privacy page element.

  • How to change the default apex port

    hi,
    i am installed apex4.0 in EBS R12 DB with HTTP Server method. my apex is running from application server 10g and default port is 7777.
    URl: http://hostname:7777/pls/apex
    My EBS R12 running on http://hostname:8007.
    is it possible to change the apex port to EBS Apache port(8007) in R12 and finally i want to change above URL like this
    Before change : http://hostname:7777/pls/apex
    After Change : http://hostname:8007/pls/apex
    Thanks in advanace....

    How to Change the Default SSH Port from Terminal ?
    now showing default SSH Port 22 i need change it pls help me how can do

Maybe you are looking for

  • Medição de Distâncias usando Camera USB

    Estou desenvolvendo um sistema que utiliza medição de distâncias através de análise de imagem. Essas imagens serão providas por uma camera USB. Não possuo o pacote IMAQ Vision e por isso a aquisição da imagem e tratamento dos elementos será feito "na

  • Why doesn't Preview shortcut for 'Go to page' work

    In Preview, the keyboard shortcut key for "Go to page" is supposed to be Option-Command-g. This is not working for me in Preview 7.0 under OS X 10.9.5. How fix?

  • How long do you need to charge a new iPhone 5 for before trying to turn it on?

    I received a new iphone 5 in the post today to replace the ne I had smashed the screen on. I was told that I would need to charge the phone and then insert my SIM and it would be good to go. The phone has been on charge since 14:00 and still wont tur

  • Unable Unlock a User when controlled organization is not assigned as Top

    Hi, When a admin user with controlled organization and organization other than top tries to unlock a user it is throwing an error as "user has no resources assigned". I tried assigning admin role with controlled orgnaization as Top:Example and contro

  • Error while trying to update to 7.5

    I'm trying to update my iTunes to 7.5 but it said there was an error and to just download and install manually but there's an error saying Invalid Drive: H:\. So yea, any suggestions and help is much appreciated.