Learning stored procedures...why doesn't it work right?

this SP makes a new table actypes from distinct
value from a column in table log_book
the "distinct" is not working ...it is getting too many values
create or replace
procedure doactypes as
CURSOR ac_type IS
select distinct actype from log_book;
v_actype varchar2(32);
begin
open ac_type ;
dbms_output.put_line('...aircraft type = '||v_actype);
loop
FETCH ac_type INTO v_actype;
EXIT WHEN ac_type%NOTFOUND OR ac_type%NOTFOUND IS NULL;
insert into actypes values ( actype_id.NEXTVAL,v_actype);
END LOOP;
COMMIT;
dbms_output.put_line('done');
CLOSE ac_type;
exception
when NO_DATA_FOUND then
dbms_output.put_line('error');
end doactypes;

if I do
select * distinct actype from log_book;
I get no non-distinct values.Really? I get this:
SQL> SELECT * DISTINCT dummy FROM dual;
SELECT * DISTINCT dummy FROM dual
ERROR at line 1:
ORA-00923: FROM keyword not found where expectedNote that <tt>DISTINCT</tt> is not a function. It applies to the whole SELECT list.

Similar Messages

  • I recently bought a lightning to 30 pin adapter for my new iPad so that I could continue to use my 30 pin to VGA cord, but when I plug the VGA cord into it it says it is not supported. They are all apple products, so why doesn't it work?

    I recently bought a lightning to 30 pin adapter for my new iPad so that I could continue to use my 30 pin to VGA cord, but when I plug the VGA cord into it it says it is not supported. They are all apple products, so why doesn't it work?

    If it is a lightning to 30 pin adaptor, and you have a 7th Generation Nano it has to fit the Nano.
    This is lightning to 30 pin adapter: http://www.bestbuy.com/site/Apple%26%23174%3B---Lightning-to-30-Pin-Adapter/6651 936.p?id=1218803450821&skuId=6651936#tab=overview
    Is this what you bought?
    You need to contact Sony and see if they model you have is compatible with the docking adapter. It may not be.

  • Why doesn't siri work away from home

    why doesn't siri work way from home

    It does for me. But it requires an Internet connection, so if you don't have mobile data turned on or your account isn't provisioned for it or you are out of range of a cell tower Siri can't talk to the servers.

  • Why doesn't LightScribe work with my Snow Leopard?

    Why doesn't LightScribe work with my Snow Leopard? It downloaded and is in my printer folder, but won't open.

    Are you really still running 10.6.3? If you are you should run the combo update as many issues were resolved within the updates themselves.
    Mac OS X 10.6.8 Update Combo v1.1

  • I have Elements 12 installed.  When I am in the catalog, click on a photo, then want to open the Editor, I get an error message.  If I click on Editor from the Welcome screen, I get the same error message.  Why doesn't Editor work?  Thanks.

    I have Elements 12 installed.  When I am in the catalog, click on a photo, then want to open the Editor, I get an error message.  If I click on Editor from the Welcome screen, I get the same error message.  Why doesn't Editor work?  Thanks.

    You'd better ask in the Elements forum.
    Photoshop Elements

  • Why doesn't flash work during panorama pictures

         why doesn't flash work during panorama pictures

    HI..
    Try troubleshooting the Flash plugin ..
    Quit Safari.
    Open System Preferences > Flash Player then select the Storage tab. Click: Delete All
    Now uninstall the Flash plugin then reinstall new >  Troubleshoot Flash Player | Mac OS
    Very important to uninstall the currently installed Flash plugin before reinstalling.
    Launch Safari From your Safari menu bar click Safari > Empty Cache
    Now try a video.
    BTW... if you have the ClickToFlash extension installed, that can prevent Flash based video from streaming. It can also be installed as a plugin in /Library/Internet-Plug-Ins.
    And check to see if Safari is running in 32 bit mode. Right or control click the Safari icon in your Applications folder then click Get Info. If the box next to:  Open in 32 bit mode  is selected, deselect, quit then relaunch Safari.

  • Iphone 3g - why doesn't it work?

    I purchased a new pair of Nike running shoes excited to link up the sensor and get started using with my iphone 3G. However, I find out the Nike Plus only works with an iphone 3GS. I'm now going to have to return the Nike Sensor for a refund instead of having to upgrade to another Iphone model. Is there anyway around this? Why doesn't it work with the Iphone 3G? What makes the operating system in the 3GS different so it works?

    As evidence too there is a hack which gets it working as well:
    http://mymojo.ca/index.php/2009/12/31/weekend-project-nike-and-iphone-3g-part-1/

  • I've got a serial number for Contribute but it won't activate on one of our computers. Right now we have to use the 30 day trial. Why doesn't it work?

    I've got a serial number for Contribute but it won't activate on one of our computers. Right now we have to use the 30 day trial. Why doesn't it work? Marianne Stanton, The Inquirer and Mirror, Nantucket, MA: Sign in: [email protected]

    Here's the serial number I have and have used on other machines:
    < Removed by Moderator >
    "This serial number is not valid for this product."
    OS 10.7.5
    Contribute 6.5
    Greg Derr
    <Removed by Moderator>

  • Why doesn't Nike+ work with the 1st Gen Ipod touch with 2.1 software?

    Why doesn't Nike+ work with the 1st Gen Ipod Touch with 2.1 software?

    The second gen iPod Touch has firmware version 2.1.1(5F138) whereas the 1st Gen only allows 2.1 (5F137). Don't know if that has anything to do with it, but it's likely.
    Why doesn't Apple allow those with the Nike+iPod sports kit to use their external sensor on the 1st Gen iPod Touch?!?! I can't see why the sensor would be incompatible with the right firmware upgrade!!

  • DDL in stored procedures: why not?

    Hi all...
    I am an Oracle beginner and am using 8i to return data from oracle to ASP pages via ADO and ODBC.
    I created the necessary packages in my Oracle tablespace and they contained DDL - I have a very complex query which I don't want to have to encapsulate in one select statement. I want to create a number of temporary tables to store the intermediate data returned from the DB. Therefore I need to be able to have 'create table <name> as...' in my package. Once all the tables have been created I then want to drop them at the end of the procedure. This seems perfectly reasonable to me - what is the use of a stored procedure if you can create or drop a table?!?!
    So, my question is this: why is it that you can't have DDL in a package or stored procedure? I'm pretty sure both SQL Server and Sybase allow DDL in a stored proc - so why doesn't Oracle allow it?
    And if you really can't have DDL in an sp then what is the alternative?
    Hoep someone can help out a rank beginner here - thanks!!
    Mike.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Rasmus Mencke ([email protected]):
    Hi,
    You can use dynamic sql, it is very easy to do what you are trying to accomplease.
    Procedure test is
    sql_stmt varchar2(200); -- Variable to hold sql string
    BEGIN
    -- Create the SQL Statement
    sql_stmt := 'create table tmp (id number(1), text varchar2(200));'
    -- Fire the SQL Statement
    execute immediate sql_stmt;
    sql_stmt := 'drop table tmp';
    execute immediate sql_stmt;
    END;
    <HR></BLOCKQUOTE>
    Thanks Rasmus - I tried it but got errors. As you can see from the code below I am using a cursor to store the data to return to ADO in tables. To give you an idea of what I want to do here is my package body spec:
    CREATE OR REPLACE PACKAGE BODY Network_Elements_Report
    AS
    Procedure GetNetworkElements (
    i_Node IN VARCHAR2,
    NE_Node OUT tblNE_Node,
    NE_Type OUT tblNE_Type,
    EHA OUT tblEHA,
    Status OUT tblStatus,
    Curr_Func OUT tblCurr_Func,
    TP_Name OUT tblTP_Name,
    Order_Name OUT tblOrder_Name,
    Required_Start OUT tblRequired_Start,
    Required_End OUT tblRequired_End,
    Trail_Name OUT tblTrail_Name);
    SQL_stmt varchar2(200);
    IS
    CURSOR nerep_cur IS
    -- Just a simple execute immediate test!
    -- Actual SQL to go here much more
    -- complicated!!
    SQL_stmt := 'create table tmp as select * from nerep4;';
    execute immediate SQL_stmt ;
    SELECT NE_Node, NE_Type, EHA, Status, Curr_Func, TP_Name,
    Order_Item_Name, Required_Start, Required_End, Trail_Name
    FROM tmp
    WHERE NE_Node = i_Node
    SQL_stmt = 'drop table tmp;';
    execute immediate SQL_stmt ;
    recCount NUMBER DEFAULT 1;
    BEGIN
    FOR NE_Rec IN nerep_cur
    LOOP
    NE_Node(recCount) := NE_Rec.NE_Node;
    NE_Type(recCount) := NE_Rec.NE_Type;
    EHA(recCount) := NE_Rec.EHA;
    Status(recCount) := NE_Rec.Status;
    Curr_Func(recCount) := NE_Rec.Curr_Func;
    TP_Name(recCount) := NE_Rec.TP_Name;
    Order_Name(recCount) := NE_Rec.Order_Item_Name;
    Required_Start(recCount) := NE_Rec.Required_Start;
    Required_End(recCount) := NE_Rec.Required_End;
    Trail_Name(recCount) := NE_Rec.Trail_Name;
    recCount := recCount + 1;
    END LOOP;
    END GetNetworkElements;
    END Network_Elements_Report;
    When I run this I get Oracle error:
    "PLS-00103: Encountered the symbol "CURSOR" when expecting one of the following..." etc, etc.
    What have I got wrong here? Also, given that the actual SQL I want to execute is around 40 lines long and it creates 4 temp tables, can I store this is a seperate .SQL file and use execute immediate to use the contents of the SQL file? eg: execute immediate nerep.sql - I guess I mean like some sort of 'include' file.
    Hope this is slightly clearer than mud!!
    Thanks for your help...
    Mike.
    Bear in midn that
    The actual SQL I will have in

  • Why doesn't JavaMail work, but PHP mailer does?

    I am trying to use JavaMail to send emails from my webserver. I've plugged in the host and the addresses are valid, but I am getting 550 errors. I've searched and found that I should change a setting on my mail server to allow relays from my webserver. However, we have a PHP mailer working on our webserver now, so presumably that relay is already in there. Why does the PHP work but the JavaMail doesn't?

    Can you turn on session debugging and post the protocol trace that shows the failure?
    The error codes alone are not enough, you usually need to look at the message included
    with the error code.
    Also, have you found the JavaMail FAQ?

  • Stored Procedure with in param not working

    I have  a stored procedure that works  now I need to use an in Parameter . when I made modification now the stored proc says  "Source does not have a runnable target." I can't seem to figure out what is wrong wit it.
    using SQL developer  version 1.5.5
    here is the  stored proc
    CREATE OR REPLACE
    PROCEDURE STATEMENT_DOMESTIC_TEST
    ( s_date IN statement.statementdate%Type
    ) AS
    BEGIN
    INSERT INTO STATEMENT_DATA
                      (   STATEMENTNUMBER,
                          STATEMENTTOTAL,
                          STATEMENTDATE,
                          BALANCE_FORWARD,
                          CUSTID,
                          CUSTNAME,
                          STATEMENTPURCHASES,
                          STATEMENTPAYMENTS,
                          NOMAILNOPRINT,
                          SOLDTOCOUNTRYNAME,
                          CREDITZEROFLAG,
                          SOLDTOCOUNTRYCODE)
                SELECT  STATEMENTNUMBER,
                        STATEMENTTOTAL,
                        STATEMENTDATE,
                        BALANCE_FORWARD,
                        CUSTID,
                        CUSTNAME,
                        STATEMENTPURCHASES,
                        STATEMENTPAYMENTS,
                        NOMAILNOPRINT,
                        SOLDTOCOUNTRYNAME,
                        CREDITZEROFLAG,
                        SOLDTOCOUNTRYCODE
                            FROM  EROCKS.PS_JWF_STATEMENT
                                  WHERE (statementdate = s_date)and (STATEMENTTOTAL >0)
                                        and (SOLDTOCOUNTRYNAME is null or SOLDTOCOUNTRYNAME='US')
                                        and (TRIM(NOMAILNOPRINT) is null and NOMAILNOPRINT!='99');
    update STATEMENT_DATA H
                        set
                          ( H.REMTO_ZIP,
                            H.REMTO_CITY,
                            H.REMTO_STATE,
                            H.REMTO_MAILNAME,
                            H.REMTO_ADDR1,
                            H.REMTO_ADDR2,
                            H.REMTO_ADDR3,
                            H.SOLDTO_CITY,
                            H.SOLDTO_STATE,
                            H.SOLDTO_ZIP,
                            H.SOLDTO_ADDR1,
                            H.SOLDTO_ADDR2,
                            H.SOLDTO_ADDR3,
                            H.PHONE_PREFIX,
                            H.PHONE_NUMBER,
                            H.COMPANY_NUMBER,
                            H.STATEMENTMISC_CREDIT1,
                            H.STATEMENTMISC_CREDIT2)=
                      (SELECT J.REMTO_ZIP,
                              J.REMTO_CITY,
                              J.REMTO_STATE,
                              J.REMTO_MAILNAME,
                              J.REMTO_ADDR1,
                              J.REMTO__ADDR2,
                              J.REMTO_ADDR3,
                              J.SOLDTO_CITY,
                              J.SOLDTO_STATE,
                              J.SOLDTO_ZIP,
                              J.SOLDTO_ADDR1,
                              J.SOLDTO_ADDR2,
                              J.SOLDTO_ADDR3,
                              J.PHONE_PREFIX,
                              J.PHONE_NUMBER,
                              J.COMPANY_NUMBER,
                              J.STATEMENTMISC_CREDIT1,
                              J.STATEMENTMISC_CREDIT2
                              FROM STATEMENT_HEADER J
                                  WHERE  H.STATEMENTNUMBER= J.STATEMENTNUMBER);
    INSERT INTO EROCKS.STATEMENT_DATA_DETAILS
                      ( INVOICENUMBER,
                      STATEMENTNUMBER,
                      INVOICEDATE,
                      DOC_TYPE,
                      INVOICETOTAL,
                      PURCHASES,
                      PAYMENTS,
                      MISC_CREDIT1,
                      MISC_CREDIT2,
                      BUNUMBER,
                      BUNUMBER_RU,
                      REFERENCE_NUMBER,
                      DESCRIPTION, seq_number)
                        SELECT  H.INVOICENUMBER,
                                H.STATEMENTNUMBER,
                                H.INVOICEDATE,
                                H.DOC_TYPE,
                                H.INVOICETOTAL,
                                H.PURCHASES,
                                H.PAYMENTS,
                                H.MISC_CREDIT1,
                                H.MISC_CREDIT2,
                                H.BUNUMBER,
                                H.BUNUMBER_RU,
                                H.REFERENCE_NUMBER,
                                H.DESCRIPTION,
                                EROCKS.SEQ_STATEMENT.NEXTVAL
                        FROM STATEMENT  H
                            WHERE H.STATEMENTNUMBER IN
                                (SELECT STATEMENTNUMBER
                                    FROM STATEMENT_DOMESTIC);
    END STATEMENT_DOMESTIC_TEST;

    Hello,
    could it be, that you are not connected to a database? This is what the error message suggests.
    You cannot compile or execute a stored procedure without a database connection.
    Regards
    Marcus
    BTW: you should also consider to install a newer version of SQL Developer. The current version is 3.2.2

  • Why Doesn't "find" work in VBS?

    I'm trying to write a VBS module that will
    detect when the data in a channel crosses
    some threshold. As an example, I include
    a line to check when channel 56 becomes
    greater than 5.0
    Here is the VBS line that checks for this:
    FirstValue = find( Ch(56) > 5.0, 1 )
    When ever I execute this script, DIAdem displays
    an error dialog with this message:
    Error in (Row:52, Column:9):
    Error message from DIAdem OCMD-interface:
    Invalid return value of the DIAdem kernel !
    What does this mean? Why doesn't the "find" function
    work? What other means can I use to do this operation?

    Hi jbrandim,
    The first parameter in the find() function is a string, so when you use this function with VBS syntax, you need to enclose it in double quotes:
    FirstValue = find("Ch(56) > 5.0", 1)
    Additionally, you can also call this function as a Formula Calculator function, since it is in fact a DIAdem function and not a VBS function:
    Call FormulaCalc("L1:= find(Ch(56) > 5.0, 1)")
    FirstValue = L1
    The cryptic error message is an artifact of the translation process between VBScript and the DIAdem find function. DIAdem automatically maps the return value of the find function, which is an integer, to the variant variable "FirstValue", as well as the input parameters. The mapping process from Variant to string in the first find() parameter failed, and
    that led to the error message you received.

  • Coding for Stored Procedures is a lot of work!

    Will simple Stored Procedure calls be made any easier in TopLink? Below is the JDBC code for calling a stored procedure. Following it is the lengthy TopLink code for calling the same proc.
    JDBC:
    CallableStatement stmt = conn.prepareCall("{CALL JEROME_TEST.EMP_SELECT(?,?,?)}");
    stmt.setInt(1, 7369);
    stmt.registerOutParameter(2, Types.VARCHAR);
    stmt.setString(2, "Get");
    stmt.registerOutParameter(3, Types.VARCHAR);
    stmt.execute();
    System.out.println("job = " + stmt.getString(2));
    System.out.println("name = " + stmt.getString(3));TopLink
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("JEROME_TEST.EMP_SELECT");
    call.addUnamedArgument("empno");
    call.addUnamedInOutputArgument("job", "job", String.class);
    call.addUnamedOutputArgument("name");
    DataModifyQuery query = new DataModifyQuery();
    query.setCall(call);
    query.addArgument("empno");
    query.addArgument("job");
    query.addArgument("name");
    m_session.addQuery("JEROME_TEST.EMP_SELECT", query);
    m_session.getEventManager().addListener(
            new SessionEventAdapter() {
                public void outputParametersDetected(SessionEvent event) {
                    if (((StoredProcedureCall)event.getProperty("call")).
                        getProcedureName().equals("JEROME_TEST.EMP_SELECT")){
                        DatabaseRow row = (DatabaseRow)event.getResult();
                        Object returnJob = row.get("job");
                        Object returnName = row.get("name");
                        System.out.println("job = " + returnJob);
                        System.out.println("name = " + returnName);
    Vector parameters = new Vector();
    parameters.addElement(new java.lang.Integer(7369));
    parameters.addElement("Get");
    parameters.addElement("");
    Object data = m_session.executeQuery(query, parameters);

    Much of the code you have defined is for being able to reuse the call. If you just want to execute it you can use:
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("JEROME_TEST.EMP_SELECT");
    call.addUnamedArgumentValue(new Integer(7369));
    call.addUnamedInOutputArgumentValue("job", "Get", String.class);
    call.addUnamedOutputArgument("name");
    Map row = (Map) session.executeSelectingCall(call).first();
    System.out.println("job = " + row.get("job"));
    System.out.println("name = " + row.get("name"));

  • Why doesn't tmobile work at ORD?

    Since upgrading to OS X 10.7.3, logging onto wifi networks has been much more difficult. At ORD, at least in the United Club, it is impossible using the T-Mobile network. Whenever I connect to the tmobile network, it opens the new (supposedly-quasi-automatic) wifi login screen. But it gets stuck there forever, with an indication that it is trying to connect to an apple URL. Why? Is there away around this? Here's the screen I get (forever):

    alright, you guys, forget about what i just said...   i know why it's not working, it is a file that is not as a quadratic picture but one that is just cut out of a quadratic picture. so it's probably that's why it is not working....
    so let's take this thing to a different level:
    how can i get things that i cut out from editors like gimp and made a jpeg file out of it get into imovie when they are not quadratic? 
    My idea is to make a video and add in the foreground some little pictures. something like a logo that i can't make with the writing software of imovie. So hoy can i add such a thing or is it even possible?

Maybe you are looking for

  • THIRD PARTY PO and MD04

    Hello Gurus.... Had issue with third party PO's as they do not appear in the MD04 requirement list , and came to know after searching across the internet that its not possible have the third party PO's in MD04 as the stock doesnt come to plant or to

  • ITunes on new computer won't recognise my iPod and won't sync it

    I've used an external hard drive to move my iTunes from my old computer to my new Windows laptop following the instructions on the Apple website. I authorised the computer as it asked. When I try to connect my iPod to the new computer to sync my iTun

  • *************Object Name required*******

    Hi,    Can anyone please tell me the object name(BOR) for sales order? Regards, Vijay ********REPLIES TO BE REWARDED SURELY************

  • System refresh of only ECC and not Portal and PI in MCOD

    Hello, Our QA landscape has ECC, Portal and PI installed in separate servers, but belong to the same MCOD DB. Its the same in Production too. Now we want to refresh just the ECC in QA from ECC in Production. We don't want anything to change in the PI

  • Adding an extra video track to FCP timeline?

    Hi there I'm trying to add an extra video track to the timeline to add some extra titles; the first two video spaces (V1 and V2) are being used. I'd like to add a V3. Suggestions?