If we use DML statement in function then that function can be used inside s

if we use DML statement in function then that function can be used inside select query or any DML query?

select f from t2;I think you meant to query t1.
It works if the function is an autonomous transaction:
create or replace function f return number
is
PRAGMA AUTONOMOUS_TRANSACTION;
begin
    update t1 set c=2;
    commit;
    return 1;
end;
select f from t1But as Billy said why would you want to do DML this way. And this is not the way autonomous procedures should be used either.
An an answer to an interview question though nothing wrong with it.

Similar Messages

  • I find it annoying that you can't use aliases in where statements

    I find it annoying that you can't use aliases in where
    statements
    for example:
    SELECT TOP 1
    CAST(amount
    / ( CASE WHEN ISNULL(rate, 0) <> 0 THEN rate
    ELSE 1
    END ) AS NUMERIC(10, 2)) AS num
    FROM table
    WHERE num > 1
    ORDER BY num
    Are there any workarounds?

    > I find it annoying that you can't use aliases in where
    statements
    This isn't really (or... "at all") a CF question. You're
    better off asking
    this sort of thing on a SQL Server forum.
    You could use a derived table, I guess:
    select top 1 num
    from (
    SELECT
    CAST(amount
    / ( CASE WHEN ISNULL(rate, 0) <> 0 THEN
    rate
    ELSE 1
    END ) AS NUMERIC(10, 2)) AS num
    FROM table
    where num > 1
    order by num
    (that might not preserve the intent of you SQL (sorry: it's
    late, I'm
    tired), but you get the idea.
    Adam

  • I am using iPhone 5s ,I paid $188 ,but I can't use PDF to work file this function ,it is sucks app

    I am using iPhone 5s ,I paid $188 ,but I can't use PDF to work file this function ,it is sucks app.i will complain apple of you app

    iUploader app
    "The iUploader app is the only way I know of to load files such as resumes and cover letters to sites such as Monster and CareerBuilder (those having the "Browse for File" links intended for desktop use) from an iOS device. If there is another way to do it, then I'm just not aware of it. I asked for this on the Apple discussion forum months ago and now here it is! Thank you app devs for this!" https://itunes.apple.com/us/app/iuploader-free-uploads-downloads/id541315293?mt= 8

  • HT1338 I need to bulk upload to Auctiva (auction software) but Java was disabled on my computer. I have 10.5.8 so does this mean that I can't use Java? If not, then is there a workaround to be able to use the bulk uploader from Auctiva?

    I need to bulk upload images from iPhoto to Auctiva (auction software) that will then be posted to eBay; however Java was disabled on my computer some time ago due to "known issues."  I have 10.5.8 so does this mean that I can't use Java? If not, then is there a workaround to be able to use the bulk uploader from Auctiva? As it stands now, I have to upload photos individually which is super time consuming.

    You can re-enable it for special purposes, opposite of disabling it...
    Disable Java in your Browser settings, not JavaScript.
    http://support.apple.com/kb/HT5241?viewlocale=en_US
    http://support.google.com/chrome/bin/answer.py?hl=en-GB&answer=142064
    http://support.mozilla.org/en-US/kb/How%20to%20turn%20off%20Java%20applets

  • [svn:fx-trunk] 9407: Reordering the if-statement in isMeasureFixed() exposed that hostFormat can be null when measure() is called if styles changed and measure is done before the next commitProperties .

    Revision: 9407
    Author:   [email protected]
    Date:     2009-08-19 15:11:34 -0700 (Wed, 19 Aug 2009)
    Log Message:
    Reordering the if-statement in isMeasureFixed() exposed that hostFormat can be null when measure() is called if styles changed and measure is done before the next commitProperties.  This states test exposed this.
    We should rethink if we want to clear hostFormat rather than have a hostFormatChanged flag.  If there is no hostFormat at measure then it has to be fixed because there is no line break format to check for auto-size.
    QE notes:
    Doc notes:
    Bugs: SDK-22779
    Reviewer: Gordon
    Tests run: checkintests
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22779
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/RichEditableText.as

    Oh my god, it is too long! You definitely check out types, casting and especially ODP.Net (it does everything for you)... etc. They can help you to simplify your code. I do not have enough time to copy paste it to Studio and understand and solve your issue, so I got title of your message as your main question.
    In Oracle, you can create an autonumber field by using sequences object. This is really useful when you need to create a unique number to act as a primary key.
    Basically you can create a sequence simply typing;
    CREATE SEQUENCE MY_SEQUENCE;
    now you have a sequence called "MY_SEQUENCE"... Then, I advice you select a number from sequence;
    select MY_SEQUENCE.nextval from dual;
    I said I advice actually kinda must, although it called sequence, I cannot be sequential. Do not even try to predict the value. You can be sure that it is unique number so you can use it.
    Then insert you record and use that number part of your primary key. I think that's it. Have fun.

  • Modifying code so that JCheckBox can be used instead of JComboBox

    Hello.
    how can I modify the following code so that JCheckBox can be used instead of JComboBox?
    Thanks.
    import javax.swing.*;
    import java.sql.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Exercise32_6 extends JApplet {
      private JComboBox jcboTableName = new JComboBox();
      private JTextArea jtaResult = new JTextArea();
      private JButton jbtShowContents = new JButton("Show Contents");
      private Statement stmt;
      public void init() {
        initializeDB();
        jbtShowContents.addActionListener(new java.awt.event.ActionListener() {
           public void actionPerformed(ActionEvent e) {
              jbtShowContents_actionPerformed(e);
        JPanel jPanel1 = new JPanel();
        jPanel1.add(new JLabel("Table Name"));
        jPanel1.add(jcboTableName);
        jPanel1.add(jbtShowContents);
        this.getContentPane().add(jPanel1, BorderLayout.NORTH);
        this.getContentPane().add(new JScrollPane(jtaResult), BorderLayout.CENTER);
      private void initializeDB() {
        try {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          System.out.println("Driver loaded");
          Connection connection = DriverManager.getConnection("jdbc:odbc:VideoLibrary");
          System.out.println("Database connected");
          stmt = connection.createStatement();
          DatabaseMetaData dbMetaData = connection.getMetaData();
          ResultSet rsTables = dbMetaData.getTables(null, null, null, new String[] {"TABLE"});
          System.out.print("User tables: ");
          while (rsTables.next()) {
            jcboTableName.addItem(rsTables.getString("TABLE_NAME"));
        catch (Exception ex) {
          ex.printStackTrace();
      private void jbtShowContents_actionPerformed(ActionEvent e) {
        String tableName = (String)jcboTableName.getSelectedItem();
        try {
          String queryString = "select * from " + tableName;
          ResultSet resultSet = stmt.executeQuery(queryString);
          ResultSetMetaData rsMetaData = resultSet.getMetaData();
          for (int i = 1; i <= rsMetaData.getColumnCount(); i++) {
            jtaResult.append(rsMetaData.getColumnName(i) + "    ");
          jtaResult.append("\n");
          while (resultSet.next()) {
            for (int i = 1; i <= rsMetaData.getColumnCount(); i++) {
              jtaResult.append(resultSet.getObject(i) + "     ");
            jtaResult.append("\n");
        catch (SQLException ex) {
          ex.printStackTrace();
      public static void main(String[] args) {
        Exercise32_6 applet = new Exercise32_6();
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("Exercise32_6");
        frame.getContentPane().add(applet, BorderLayout.CENTER);
        applet.init();
        applet.start();
        frame.setSize(380, 180);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }

    hello.
    thanks for the reply. i want users of my video library system to be able to view CD/DVD/Game information by name, age category, type and year. Users should be able to click on a check box (e.g. view by name, age category, type or year) and press a button. What would happen then is that data from the Product table would appear in the text area.

  • I find it rather frustrating that you can't use things like {myArray[0]} in Bindable expressions

    I find it rather frustrating that you can't use things like
    {myArray[0]} in Bindable expressions. Are there any workarounds
    apart from manually changing the dataprovider?

    Yes, instead of an array you have to use an arraycollection
    (just wrap your array) and then you can use this with the
    getItemAt()-method.
    e.g.
    {myArrayCollection.getItemAt(0)}
    cheers
    Dietmar

  • TS3992 I got a problem in my ipad2 due to "icloud backup message". I can't open my unit and am worried that I can not use my ipad anymore. What can I do. Please help me.   Thank you & GOD BLESS!

    I got a problem in my ipad2 due to "icloud backup message". I can't open my unit and am worried that I can not use my ipad anymore. What can I do. Please help me.   Thank you & GOD BLESS!

    Try to reset it. just press hold the on/off botton (ignore the red slider) just hold it then the ipad is automatically reset. dont worry about your file, there nothing happen to it. Godbless.

  • [svn] 2216: Changed InterfaceCompiler to public so that it can be used directly for mxml parsing by other tools .

    Revision: 2216
    Author: [email protected]
    Date: 2008-06-24 13:34:15 -0700 (Tue, 24 Jun 2008)
    Log Message:
    Changed InterfaceCompiler to public so that it can be used directly for mxml parsing by other tools. Also change parseMxml to public.
    Reviewed by: Paul
    Modified Paths:
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/InterfaceCompiler.java

    Before I read this helpful post, I changed my Google search key words from "change location Firefox profiles" to "change path Firefox Profiles" and found this link: http://kb.mozillazine.org/Thunderbird_:_FAQs_:_Changing_Profile_Folder_Location. This brought me to the article "Moving Your Firefox Profile" which answered my question. Your suggested link would have ultimately led me to the same solution.
    The problem was that I had copied my Firefox profile to the new location and then modified "profiles.ini" to point to the new location and saved it there as a replacement to the original "profiles.ini" that I had renamed "profiles.iniOld." Even though I had changed "IsRelative" from "=1" to "=0" I got error messages. I had used this procedure successfully before, but it would not work this time. When I used Profile Manager to move the Firefox Profiles everything worked fine the first time I tried it, and it took only a few minutes.
    Thank you, cor-el.

  • HT1430 My iPhone display sometimes getting bigger than normal size. So big sometimes  that I can't use it and I must turn it off. Anyone know what happened ?

    My iPhone display sometimes getting bigger than normal size. So big sometimes  that I can't use it and I must turn it off. Anyone know what happened ?

    You most likely have zoom on. Double tap with THREE fingers to turn zoom off, if it is on, then: Settings>General>Accessibility...turn it off for good.

  • I have  my photoshop cc installed on my Mac and my windows laptop is it true that I can only use one or the other now? and if this is the case if my mac were turned off should my laptop now work? I am on the photoshop photography program

    i have  my photoshop cc installed on my Mac and my windows laptop is it true that I can only use one or the other now? and if this is the case if my mac were turned off should my laptop now work? I am on the photoshop photography program its just that i have never noticed tho before i have my mac turned on and the laptop PS works fine on the Mac but not on the Laptop

    Hello,
    see >>> http://helpx.adobe.com/creative-cloud/help/install-apps.html  here >>> How many computers can I install on
    I quote: You may install software on up to two computers. These two computers can be Windows, Mac OS, or one each.
    If you install on a third computer, it will request you to de-activate on the other two computers. You can then reactivate one of the previous two computers, and use Creative Cloud apps on it.
    Good luck!
    Hans-Günter

  • Have a 802.11n time capsule, the range of the wireless network has shrunk down to nothing over last few days. Used to be able to use wireless network anywhere in house, but now can only use in my office. Will not connect to iphones, ipad, itouch, or noteb

    Have a 802.11n time capsule, the range of the wireless network has shrunk down to nothing over last few days. Used to be able to use wireless network anywhere in house, but now can only use in my office. Will not connect to iphones, ipad, itouch, or notebook. Worked fine last week, but over weekend just started having issues.

    It is very possible that you may have some form of Wi-Fi interference that has appeared recently that is preventing your Time Capsule (TC) from providing a clean RF signal.
    I suggest you perform a simple site survey, using utilities like iStumbler, or AirRadar to determine potential areas of interference, and then, try to either eliminate or significantly reduce them where possible. Look for other Wi-Fis that may be operating nearby. Note those with the strongest signals and which channels they are operating on ... then change the channel used by the TC to be at least 3-5 channels away.

  • Hi, I activated my CS6 in 2012 under my student licence and still using it. I've heard that you can't run CS6 on multiple computers. How do I transfer it from one computer to another as I am switching computers?

    Hi, I activated my CS6 in 2012 under my student licence and still using it. I've heard that you can't run CS6 on multiple computers. How do I transfer it from one computer to another as I am switching computers?

    Hi,
    first, I'm not Adobe's "slave" as you might to accuse me. Most of the posters here are users like me.
    I only can repeat that what I found in Adobe's help sites, as I wrote above. You are free to figure out the "real" truth and - the best would be - you may contact Adobe directly, here are - I'm sure you know them -  the links I would use: http://helpx.adobe.com/support.html  and http://helpx.adobe.com/contact.html.
    Hans-Günter

  • I have two iphones, different telcos, i am using the same apple id for both - how can i use the 10GB icloud free memory of my new iphone 5?

    I have two iphones, different telcos, i am using the same apple id for both - how can i use the 10GB icloud free memory of my new iphone 5?

    Thank you KiltedTim!
    YES, that is the free 5GB icloud memory for each apple ID. Can I not add the free 5Gb of my second Iphone to my original apple ID (5GB also) as I want to use one Apple ID name on both 2 Iphones? Is it necessary to have a different apple ID for the second Iphone to avail the free 5GB it carries with it?

  • How to store data in hashmap so that it can be used by different methods.

    Hello,
    I have an ADF/JSF application and the database is DRM. The program gets data from DRM into this hashmap. Program needs this data frequently. Getting this HashMap is very resource intensive due to a lot of data it has.
    I want to get the data in HashMap once ( I can do this - no problem).  But where/how do I keep it so that different methods can just use this and not make individual trips to DRM? It may be a very basic java question but I seem to be stuck :)
    I am not very concerned about the HashMap part, it can be any collection - the question is of storing it so that it can be used over and over.
    Thanks,

    User,
    If I understand you correctly, you have a JSF application that needs to store data in a HashMap such that it can be accessed over and over? You could put the hashmap into an appropriately-scoped managed bean and access it from there. I'm not sure what a "DRM" is (a digital rights management database, perhaps, in which case it's a "database"), so there is something special about a "DRM" that we need to know, please share.
    John

Maybe you are looking for

  • Help on Wiping My Mac Book Pro and Reinstalling

    I got a new Mac Book Pro in January.  It is running Lion and OS 10.7.2.  When I got it the Apple Store transferred all my settings, files etc from my previous Mac Book Pro (running Snow Leopard). Since getting my new Mac the battery life is terrible

  • Where can I get my PS-X600 turntable repaired?

    Where can I get my Sony PS-X600 turntable repaired?  Preferably Southern California.  When started, the table does not turn.  It has been stored for a long time. Thanks Solved! Go to Solution.

  • Add missing fonts in SAP System

    Hello, There is fonts option on sap easy access screen Customize Local Layout (Alt + F12) --> Font (I18N) Here we can see some fonts. My question is can we add Fonts here, because Fonts like Tahoma, TimesNewRoman, Verdana are not listed in that list.

  • Error Encountered 0x80040FB3, Check Documentation

    I ahve been using the desktop software successfully for a number of months.  Recently a colleague changed an appointment (Outlook 2007) that I added to my clanedar. Now, when I try to synch the Curve (8330), I receive a dialog box explaing the differ

  • How to fix "A 32-bit agent is installed on 64-bit operating system" alerts

    Hi We have installed SCOM 2007 R2 CU1 in our environment (by properly following installation sequence given on the CU1 web page). After manually installing agent update of CU1 on 64 bit servers, we are getting alerts "A 32-bit agent is installed on 6