Can we create a cursor that can hold records of any table

DECLARE
     CURSOR cr_tablenames IS
          SELECT tname
          FROM tab;
     v_tablename tab.tname%TYPE;
BEGIN
     OPEN cr_tablenames;
     LOOP
          FETCH cr_tablenames INTO v_tablename;
          EXIT WHEN cr_tablenames%NOTFOUND;
          DBMS_OUTPUT.PUT_LINE('Table: '||v_tablename);
          -- HERE, I WANT TO PERFORM SELECT * OPERATION ON
          -- EACH TABLE WHOSE NAME COMES INTO v_tablename
          -- AND DISPLAY THE RECORDS
     END LOOP;
END;
I want to perform SELECT * operation on each table whose name comes into the variable and display the records. How to achieve it? I am clueless.
Can this be achieved by something like... using cursors which can be defined dynamically and which can hold records of any table?
Or, do I need to have some different approach to this problem?
Edited by: kartins on Nov 5, 2009 11:41 PM

something like
SQL> create or replace
  2  function getContent (p_tn in varchar2)
  3     return sys_refcursor
  4  is
  5     retval sys_refcursor;
  6  begin
  7     open retval for
  8       'select * from '||p_tn;
  9     return retval;
10  end;
11  /
Function created.
SQL>
SQL> var rc refcursor
SQL>
SQL> begin
  2     :rc := getContent ('emp');
  3  end;
  4  /
PL/SQL procedure successfully completed.
SQL>
SQL> print rc
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
      7369 SMITH      CLERK           7902 17-DEC-80        900                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1700        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1350        500         30
      7566 JONES      MANAGER         7839 02-APR-81       3075                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1350       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2950                    30
      7782 CLARK      MANAGER         7934 09-JUN-81       2551                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3100                    20
      7839 KING       PRESIDENT            17-NOV-81       5100                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1600          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1200                    20
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
      7900 JAMES      CLERK           7698 03-DEC-81       1050                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3100                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1400                    10
14 rows selected.
SQL>
SQL> begin
  2     :rc := getContent ('dual');
  3  end;
  4  /
PL/SQL procedure successfully completed.
SQL>
SQL> print rc
D
X

Similar Messages

  • Can we create AI template that can be rendered into vectors

    Hi Everyone.
    Sorry if I am asking a repeated question.
    I am trying to create a script ( or find a third party tool ) that will convert PDF/Image to vector for engraving.
    Just like this page "Precision Bitmap To Vector Conversion Online- Vector Magic"
    I have tried Inkscape for this but the SVG file generated by this tool is no good for engraving.
    So now I am seeking solution in Adobe illustrator.
    I know that this is feasible as people have done this.
    Thanks in advance.

    It is possible to record actions to create automatic image traces & expand them (if necessary), then play the actions via script.  However, it can depend on the structure of your document, how you can accomplish this.  Also, the Illustrator version must be >= CS6
    You can try to make a first experiment by manually using image trace to make an Image Trace art item in Illustrator and do no further action, then send to engraver.  If your engraver recognizes the vector lines in the Image Trace object, that will be most likely all you need- otherwise, you may need to add the action to expand the trace object into lines.

  • How can I create a slideshow that depicts only a version of a photo rather than the original? Since the original and new versions are saved together, the aperture slideshow often choices the original rather than the desired version to display/

    How can I create a slideshow that depicts only a version of a photo rather than the original?   Since the original and new versions are saved together, the aperture slideshow often choices the original rather than the desired version to display.

    There are two things we use the name "Slideshow" for in Aperture:  a Slideshow Album, used for making Slideshows, and the Slideshow that is made.  (Imho, it is a design mistake to not call the containers used to create Slideshows, Books, etc., "Albums".)
    The Slideshow will use the Album Pick from any Stack.  A good way to use Aperture is to promote the Image you want to regularly use (such as, for example, a Version with adjustments) to the top of the Stack.  This makes it the Stack Pick, and will be the default Album Pick.  If you haven't done that, you can still change the Album Pick for any Stack in a Slideshow Album.  Expand your Stack(s), select the Image in each Stack that you want to be the Album Pick (and thus shown in the Slideshow), and "Stacks➞Set Album Pick".  (Note the keyboard shortcut; there is also a Toolbar icon for this.)  The change is immediate.  The Slideshow will always show the Album Pick (or, if there is not one, the Stack Pick) for every Stack in your Slideshow Album.

  • Can I create a form that doesn't trigger Acrobat's JavaScript disabled / security issues warning?

    Hello,
    Can I create a pdf that doesn't trigger Acrobat's JavaScript is currently disabled and this document uses it for some features.  Enabling JavaScript can lead to potential security issues.
    I even get this error when I create a blank pdf.
    I'm not using any JavaScript in the form and the nature of the message might tend to be a bit scary to some people since it mentions enabling JS can lead to potential security issues.  I basically want to disable the messaging of a feature I'm not even using.
    Anyone know if this is possible and if so, how I go about it?
    Thank you.

    Hi,
    I too share your frustration!!
    Unfortunately I do not have a complete answer for you.
    From the start I must say that Stefan Cameron has been very helpful (http://forms.stefcameron.com/2010/01/14/acrobatreader-9-3-now-available/), however I have not had sufficient time available to deal with the issue (or find a satisfactory resolution).
    The original post that Srini shared with you related to an XFA form that had FormCalc and Javascript in it. I will now share with you another situation that is closer to your experiences.
    Sometimes where we have a complex solution/form, we often give our users a PDF with instructions and demonstrations. We generate these using Adobe products:
    LiveCycle Designer ES to generate the solution/form;
    Captivate to record the demonstration (.swf);
    Acrobat to package it up in a static PDF.
    The screen shots below are from a PDF that includes written instructions and six Flash (.swf) files. The PDF does NOT include fields/form objects and does NOT include any FormCalc or Javascript.
    One of the big sells in Acrobat 9 was that Adobe had fully integrated Flash (Adobe product, ex. Macromedia) into Acrobat 9. This mean that .swf files could run natively inside a PDF. Brilliant!!!  The website today is still pushing this message, for example:
    Now bear in mind that the following screenshots are from a PDF that does not contain any scripting - its sole purpose is to "inform" the user, "look as good as the work I put into it", incorporate instruction and "multimedia" in a "single polished file" and I should be "confident that my audience will be able to view my work exactly as intended".
    Not so!!
    When the user now opens the form, all looks OK. No warning. They can read the instructions and scroll down to the multimedia (.swf files).
    However when the user clicks on the multimedia, the yellow bar appears:
    I go through the "trust" process:
    And the PDF looks like it is OK, no yellow bar. When I click on the multimedia, it begins to play - yes!! BUT ONLY FOR A SECOND OR TWO AND THEN IT STOPS AND GOES BACK TO THE START - AGGGGHHHHHHH!!!!!. I would apologise for shouting, but this is beyond frustration. The work in capturing six screencasts in Captivate, annotating them, publishing to .swf and packaging up in Acrobat has been a complete waste of time. Worse than that I now have several PDFs out there, that do not work. Good advertisement for my business? I don't think so!!
    The document that Stefan provided (Managing JavaScript Execution in the Acrobat Family of Products) does not mention Flash/.swf as being a problem. However I would recommend that you go through this document, as it may help you.
    So, where to now? I don't know. The previous posts and Stefan's responses have several urls that may help. You should maybe consider logging your experiences as a bug (log at Adobe).
    In the meantime good luck,
    Niall
    UPDATE:
    This behaviour (.swf playing for only a few seconds) happens in PDFs where the .swf is inserted as legacy media to run in earlier versions of Acrobat/Reader. In this case Acrobat/Reader is making an external call to Flash Player. Hence the yellow bar. However it does not explain why the Flash video still does not play when trusted.
    If the .swf is added into the PDF as Flash media to run on Acrobat 9 and above, then it works without displaying the yellow warning bar.
    So maybe any feature of your PDF that calls an external resource is likely to show the yellow warning bar.

  • In DPS/Indesign for iPad - How can i create a button that once tapped, will pre-populate an email?

    In DPS/Indesign for iPad - How can i create a button that once tapped, will pre-populate an email? like when you tap a recipe in Marth Stewart Every Day Food for example....

    http://forums.adobe.com/message/4190932

  • Can I create a button that copy's a certain test to my clipboard?

    Can I create a button that copy's a certain test to my clipboard?
    For example, when I click the button on the website, then the next time to paste somewhere, a specific text appears?
    If this is possible, could someone please explain how? =(

    Hi Travis,
    There is no native feature in Muse to achieve this. However, you can use custom code to achieve this. Please refer to the following link for the sample code : How to copy to the clipboard in JavaScript? - Stack Overflow
    Regards,
    Aish

  • How to create a user that can login the LDAP?

    I want to create a user that can login the OID/LDAP. I know how to create a user, it is allowed to login OIDDAS, but I also want the user to grant access to ldap directly. How do i do that?
    And how can I give it read rights and or update/delete rights on a specific tree?
    Regards
    Eelco

    Eelco,
    did you see the OiD developers guide? Here you find some examples how to create users in OiD using pl/sql or java.
    http://download-west.oracle.com/docs/cd/A97329_03/manage.902/a95193/smplcode.htm#637294
    how to use directory access control can be found in
    http://download-west.oracle.com/docs/cd/A97329_03/manage.902/a95192/access.htm#1054232
    --Olaf

  • Can you create a template that has a header and footer to forms?

    Can you create a template that has a header and footer to forms?

    Yes but how are they going to create the Landscape versions?
    The problem with doing it in Pages '09 as rotated content is that the Headers and Footers are not rotated and there is inherent clumsiness in the rotated content usually being too large for the page when viewed at 90°.
    Best to make it in two or more separate documents.
    Peter

  • Whats the best software for photo editing and creating product catalogues that can be saved as PDF's

    Whats the best software for photo editing and creating product catalogues that can be saved as PDF's

    You are asking two different questiions:
    1. What's a good photo editor? Answer to that here is probably obvious.
    2. What's a good desktop publishing/page layout program for creating PDF files for production? Answer, not PSE. It's a photo editor, not a page layout program.

  • I want to create fillable PDF that can be used by many people running on both MAC and PC.  What Adobe product should I use?

    want to create fillable PDF that can be used by many people running on both MAC and PC.  What Adobe product should I use?

    Hans-Gunter
    Thanks so much.  I downloaded Acrobat XI.  It's been "extracting" for the past 30 minutes (even with a fast wi-fi).  Hope this is not a problem.
    Anne

  • How to create a vi that can be connected to any type of array

    I would enjoy to create a vi that can perform an operation (like resizing) on any type of array (array of string, of cluster, of num,...): Which type of control or indicator could I use for this purpose? Any Idea?
    Thank's for your help

    Olivier,
    to do this you have to use a variant input. You can wire any type of data to a variant input. Inside the VI you flatten the variant to a string. The flattened string of an array contains both data and length of the array. You reshape the array manipulating the string. When done, you unflatten the data to a variant and output it from the VI. The caller has to convert the variant input to the source array type. OpenG.org provides a quite extensive toolkit to manipulate variant data. Some VIs specifically manipulates arrays. To see a description of VIs go to : http://opengtoolkit.sourceforge.net/lvdata/index.html
    LabVIEW Data Tools can be downloaded from http://sourceforge.net/projects/opengtoolkit/
    You need both packages lvdata AND error.
    LabVIEW, C'est LabVIEW

  • Can I create order forms that calculate the exact total with taxes?

    Can I create order forms that calculate the exact total with taxes?
    The customer needs to know exactly how much everything will cost before submitting. I can handle the actual payment portion manually.

    thanks for the info;
    I'll inform the admin dude that they need an upgraded acrobat to do forms.

  • How do i create a stensil that can be added into diffrent files of adobe reader?

    I want to create a stencil that can be used in multiple adobe files for quality check purpose. Will be helpfull if somebody helps me out on this.

    why are you saying
    Pat Willener wrote:
    Please stay in your own topic, and answer the questions asked!

  • Can I create a JAR that is an Applet and Desktop app at the same time?

    Hi mates.
    Can I create a JAR that is an Applet and Desktop app at the same time?
    Thanks.

    Ricardo_Ruiz_Lopez wrote:
    ..I have one problem, I want a JMenuBar but I can't add it inside a jPanel.
    Any idea?
    SSCCE
    It can be compiled/run as an applet or application something like this (e.g. for a Win command prompt).
    C:\Users\Andrew\Hybrid> javac Hybrid.java
    C:\Users\Andrew\Hybrid> java Hybrid
    C:\Users\Andrew\Hybrid> appletviewer Hybrid.java
    C:\Users\Andrew\Hybrid> // YES the previous line requires a '.java'  suffix - trust me.  ;-)Code
    // <applet code='Hybrid' width='600' height='400'></applet>
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class Hybrid extends JApplet {
        public void init() {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    GUI gui = new GUI();
                    getContentPane().add( gui.getMainPanel() );
                    setJMenuBar( gui.getMenuBar(false) );
                    validate();
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    JFrame f = new JFrame("Test Hybrid");
                    f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
                    GUI gui = new GUI();
                    f.setContentPane(gui.getMainPanel());
                    f.setJMenuBar(gui.getMenuBar(true));
                    f.pack();
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    class GUI {
        private JPanel mainGui = null;
        private JMenuBar menuBar = null;
        public JPanel getMainPanel(){
            if (mainGui==null) {
                mainGui = new JPanel( new BorderLayout(3,3) );
                mainGui.setBorder( new EmptyBorder(5,5,5,5) );
                JToolBar tb = new JToolBar();
                for (int ii=1; ii<6; ii++) {
                    tb.add( new JButton( "Btn " + ii) );
                    if (ii%2==0) {
                        tb.addSeparator();
                mainGui.add(tb, BorderLayout.NORTH);
                mainGui.add( new JSplitPane(
                    JSplitPane.HORIZONTAL_SPLIT,
                    new JScrollPane(new JTree()),
                    new JTextArea(20,20)
                    ), BorderLayout.CENTER );
                mainGui.add(new JLabel("Main user interface.."), BorderLayout.SOUTH);
            return mainGui;
        public JMenuBar getMenuBar(boolean isFloating) {
            if (menuBar == null) {
                menuBar = new JMenuBar();
                if (isFloating) {
                    JMenu fileMenu = new JMenu("File");
                    fileMenu.add( new JMenuItem("Exit") );
                    menuBar.add( fileMenu );
                JMenu helpMenu = new JMenu("Help");
                helpMenu.add( new JMenuItem("About") );
                helpMenu.add( new JMenuItem("Help") );
                menuBar.add( helpMenu );
            return menuBar;
    The code is not intended to be well designed. It is just written to be brief and demonstrate a few points.
    Edit 1:
    Added some access keywords in a passing gesture that the sample aimed at encapsulation.
    Edited by: AndrewThompson64 on Sep 2, 2010 1:34 PM

  • How do we create a CURSOR that consists of two TABLES

    I would like to access a cursor that has columns from two tables.

    How do we create a CURSOR that consists of two TABLESA cursor does not consist of data. A cursor is not a result set that is created in the memory of the database server and populated with "+results+".
    A cursor is source code (SQL or anonymous PL/SQL block) that has been compiled into an executable program. The execution plan (see the EXPLAIN PLAN SQL command) describes the structure of this program and how it will be executed.
    When you fetch data from a cursor, you are receiving the output of this executable program known as a cursor.
    So as the other respondents explained in this thread, you need to create SQL source code that joins tables. Then you send this SQL to the server, where it is parsed and compiled into a cursor in the database's Shared Pool (together with all other SQLs that the database received - all SQLs are compiled as cursors).
    Once this is done, you can open the cursor (execute the cursor program) and fetch data from it.

Maybe you are looking for

  • Urgent help needed in compiling JSP on websphere 6

    we are migrating our app from websphere 5 to 6 version. our app has 2 JSP files. Jsp A and Jsp B... Jsp A code if(cond met) { <%@ include file = JspB %> } Now JSP B code <bean:define id='X' /> when i run the JSP A, it throws compilation error as belo

  • D7263. Wrong printout colors under Vista/Wron​g borderless printing.

        Getting dull colors while printing under Windows Vista from Print Manager or any application (Photoshop CS3). Colors are as expected (ok) while I print those photos under XP virtual machine (from under Vista Ultimate).     Another problem is stup

  • References broken message

    I recently created a slide show in Imovie and wanted to burn it which sends it to Idvd to burn. After I burned it I decided I wanted to change the beginning, (the default curtain thing with circus music, menu page) So I went into the themes drawer an

  • XMLTable issue in 10.2.0.3 or privs problem?

    I stole the following SQL from Help with a simple XMLTable query I have been scratching my head trying to figure out why the SQL statement I coded up with a XMLTable would not run on the 10.2.0.3 DB I'm connected to. I finally found the following SQL

  • Magsafe vs. Magsafe 2

    Does anyone know what on earth possessed the designers at Apple to come up with the Magsafe 2 connector on their new power adapters? There has been a trend for Apple connectors to become smaller over time, but the Magsafe 2 has bucked this trend and