Sql select with concate of columns SP2-0734: unknown command beginning

I am running a ksh script that does some dumpster diving and pull records out.
It is basically reading a file does a select and at the end, you will see $i.
AND ORD_ORDER.ADV_ORDER_TEXT_FIELD_568='$';
I can run the script manually. (without the while loop)
But, when I run it thru the script I get a whack of errors.
SP2-0734: unknown command beginning "FROM ADVXR..." - rest of line ignored.
SP2-0734: unknown command beginning "ADVXRT_HDB..." - rest of line ignored.
SP2-0734: unknown command beginning "ADVXRT_HDB..." - rest of line ignored.
SP2-0734: unknown command beginning "ADVXRT_HDB..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
What I need it to do is pull the selected records out and place in a file.
Script
cat $TICKETS_MISMATCH |while read i
do
$SQLPLUS -silent "advxrt_hdb/$LOGONID@hdb" <<EOF >$TICKETS_MISMATCH_FULL
set feedback off
set verify off
set echo off
set heading off
set pagesize 7010
SELECT ORD_ORDER.ADV_ORDER_TEXT_FIELD_568
|| ','
|| ORD_ORDER.ORDER_NUM
|| ','
|| ORD_ORDER.ADV_ORDER_SUMMARY_FIELD_012
|| ','
|| LAB_USER.NAME
|| ','
|| LAB_USER.LOGON_ID
|| ','
|| LAB_USER.ADV_EXTENDED_USER_FIELD_001
|| ','
|| TO_CHAR(MOBILECOMP1_SR.ADV_COMPLETION_TIME_FIELD_001, 'HH24:MI:SS')
|| ','
|| TO_CHAR(MOBILECOMP1_SR.ADV_COMPLETION_DATE_FIELD_001, 'DD-MON-YYYY')
|| ','
|| MOBILECOMP1_SR.ADV_COMPLETION_NOTES_FIELD_001
|| ','
|| MOBILECOMP1_SR.ADV_COMPLETION_TEXT_FIELD_003
|| ','
|| MOBILECOMP1_SR.ADV_COMPLETION_TEXT_FIELD_013
|| ','
|| MOBILECOMP1_SR.ADV_COMPLETION_TEXT_FIELD_014
|| ','
|| MOBILECOMP1_SR.ADV_COMPLETION_TEXT_FIELD_023
|| ','
|| ORD_JOB_CODE.NAME
|| ','
|| ROUND(ASN_ASSIGNMENT.TOTAL_TIME_EN_ROUTE / 60,0)
|| ','
|| ROUND(ASN_ASSIGNMENT.TOTAL_TIME_ON_SITE / 60,0)
FROM ADVXRT_HDB.LAB_USER,
ADVXRT_HDB.SR_REPORT,
ADVXRT_HDB.ASN_ASSIGNMENT,
ADVXRT_HDB.ORD_ORDER,
ADVXRT_HDB.MOBILECOMP1_SR,
ADVXRT_HDB.ORD_JOB_CODE
WHERE (ASN_ASSIGNMENT.ASSIGNMENT_ID = SR_REPORT.ASSIGNMENT)
AND (ASN_ASSIGNMENT.FOR_ORDER = ORD_ORDER.ORDER_ID)
AND (MOBILECOMP1_SR.MOBILE_COMP1_ID = SR_REPORT.RECORD_NUMBER)
AND (ORD_ORDER.JOB_CODE = ORD_JOB_CODE.JOB_CODE_ID)
AND (SR_REPORT.USER_ID = LAB_USER.USER_ID(+))
AND ORD_ORDER.COMPLETED BETWEEN ((TO_DATE('${date_entered} 00:00:00','YYYY-MM-DD HH24:MI:SS')) - ((SELECT DECODE
(UTC_OFFSET, NULL, 0, UTC_OFFSET) FROM TZ_UTC_TO_LOCAL TZ WHERE (TO_DATE
('${date_entered} 00:00:00','YYYY-MM-DD HH24:MI:SS') BETWEEN TZ.STARTS_UTC AND
TZ.ENDS_UTC)AND TZ.TIME_AUTHORITY = 1000264000000000000000000013))/(24*60*60))
AND
((TO_DATE('${date_entered} 11:59:59','YYYY-MM-DD HH24:MI:SS')) - ((SELECT DECODE
(UTC_OFFSET, NULL, 0, UTC_OFFSET) FROM TZ_UTC_TO_LOCAL TZ WHERE (TO_DATE
('${date_entered} 11:59:59','YYYY-MM-DD HH24:MI:SS') BETWEEN TZ.STARTS_UTC AND
TZ.ENDS_UTC)AND TZ.TIME_AUTHORITY = 1000264000000000000000000013))/(24*60*60))
AND ORD_ORDER.ADV_ORDER_TEXT_FIELD_568='${i}';
exit;
EOF
done

SQL> DEFINE sqlplusrelease
DEFINE SQLPLUSRELEASE = "1002000200" (CHAR)
cat $TICKETS_MISMATCH |while read i
do
$SQLPLUS -silent "advxrt_hdb/$LOGONID@hdb" <<EOF >>$TICKETS_MISMATCH_FULL
set feedback off
set verify off
set echo off
set heading off
set pagesize 7010
SET SQLBLANKLINES ON
SELECT  ORD_ORDER.ADV_ORDER_TEXT_FIELD_568
    || ','
    || ORD_ORDER.ORDER_NUM
    || ','
    || ORD_ORDER.ADV_ORDER_SUMMARY_FIELD_012
    || ','
    || LAB_USER.NAME
    || ','
    || LAB_USER.LOGON_ID
    || ','
    || LAB_USER.ADV_EXTENDED_USER_FIELD_001
    || ','
    || TO_CHAR(MOBILECOMP1_SR.ADV_COMPLETION_TIME_FIELD_001, 'HH24:MI:SS')
    || ','
    || TO_CHAR(MOBILECOMP1_SR.ADV_COMPLETION_DATE_FIELD_001, 'DD-MON-YYYY')
    || ','
    || MOBILECOMP1_SR.ADV_COMPLETION_NOTES_FIELD_001
    || ','
    || MOBILECOMP1_SR.ADV_COMPLETION_TEXT_FIELD_003
    || ','
    || MOBILECOMP1_SR.ADV_COMPLETION_TEXT_FIELD_013
    || ','
    || MOBILECOMP1_SR.ADV_COMPLETION_TEXT_FIELD_014
    || ','
    || MOBILECOMP1_SR.ADV_COMPLETION_TEXT_FIELD_023
    || ','
    || ORD_JOB_CODE.NAME
    || ','
    || ROUND(ASN_ASSIGNMENT.TOTAL_TIME_EN_ROUTE / 60,0)
    || ','
    || ROUND(ASN_ASSIGNMENT.TOTAL_TIME_ON_SITE / 60,0)
FROM ADVXRT_HDB.LAB_USER,
       ADVXRT_HDB.SR_REPORT,
       ADVXRT_HDB.ASN_ASSIGNMENT,
       ADVXRT_HDB.ORD_ORDER,
       ADVXRT_HDB.MOBILECOMP1_SR,
       ADVXRT_HDB.ORD_JOB_CODE
WHERE     (ASN_ASSIGNMENT.ASSIGNMENT_ID = SR_REPORT.ASSIGNMENT)
       AND (ASN_ASSIGNMENT.FOR_ORDER = ORD_ORDER.ORDER_ID)
       AND (MOBILECOMP1_SR.MOBILE_COMP1_ID = SR_REPORT.RECORD_NUMBER)
       AND (ORD_ORDER.JOB_CODE = ORD_JOB_CODE.JOB_CODE_ID)
       AND (SR_REPORT.USER_ID = LAB_USER.USER_ID(+))
       AND ORD_ORDER.COMPLETED BETWEEN ((TO_DATE('${date_entered} 00:00:00','YYYY-MM-DD HH24:MI:SS')) - ((SELECT DECODE
            (UTC_OFFSET, NULL, 0, UTC_OFFSET) FROM TZ_UTC_TO_LOCAL TZ WHERE (TO_DATE
            ('${date_entered} 00:00:00','YYYY-MM-DD HH24:MI:SS') BETWEEN TZ.STARTS_UTC AND
            TZ.ENDS_UTC)AND TZ.TIME_AUTHORITY = 1000264000000000000000000013))/(24*60*60))
       AND
            ((TO_DATE('${date_entered} 11:59:59','YYYY-MM-DD HH24:MI:SS')) - ((SELECT DECODE
            (UTC_OFFSET, NULL, 0, UTC_OFFSET) FROM TZ_UTC_TO_LOCAL TZ WHERE (TO_DATE
            ('${date_entered} 11:59:59','YYYY-MM-DD HH24:MI:SS') BETWEEN TZ.STARTS_UTC AND
            TZ.ENDS_UTC)AND TZ.TIME_AUTHORITY = 1000264000000000000000000013))/(24*60*60))
        AND ORD_ORDER.ADV_ORDER_TEXT_FIELD_568='${i}';
exit
EOF
done

Similar Messages

  • "SP2-0734: unknown command..." error while importing a dump file

    hello,
    i want to import a dump file into my database named orcl, and i come accross the same error after executing the import command. my import command is:
    SQL> imp mvdemo/mvdemo file=mvdemo.dmp full=y ignore=y
    i use oracle 10g enterprise edition.
    i created the user mvdemo/mvdemo.
    the error i see in my screen is:
    SP2-0734: unknown command beginning "imp mvde..." - rest of line ignored.
    for a long period of time, i havent used oracle dbms. before, i remember that i used enterprise manager in import/export processes. however, i am not able to find the enterprise manager in 10g options now. do i have to install the enterprise manager seperately in oracle 10g enterprise edition? may this problem be relational with this matter?
    if someone could answer, i would be greatful.
    best regards

    Import is run from the command prompt, not the SQL prompt.

  • SQL Select with comma separated column value

    Hi All
    ASP VBScript
    I have a DB column named allowed_contracts that stores a
    comma separated
    list of of values e.g. 3, 5, 19, 44, 52
    I need to select records based on a variable called
    varContractList that
    contains another comma separated list i.e. 5, 44, 52
    I only want to select records where the allowed_contracts
    column contains
    each of the varContractList,
    For example only return records that have 5 or 44 or 52 in
    thier
    allowed_contracts column.
    My brain is now in a persistant vegetive state trying to work
    this out so
    any ideas would be much appreciated.
    Regards
    Bren

    Hi Jules
    Cheers for this.
    I was trying to be a bit cute (lazy even) by storing the
    project ID's as a
    comma delimted string but as we see it doesn't always pay to
    be lazy. Serves
    me right for destroying brain cells by drinking the Welshpool
    beer the other
    week whilst visiting mates down that neck of the woods. :-))
    Time for another table me thinks.
    Rgds
    Bren
    "Julian Roberts" <[email protected]> wrote in message
    news:e7i13f$mup$[email protected]..
    > Fatal flaw here Bren. In a relational database, one
    shouldn't really store
    > foreign keys as a comma delimted string. One should have
    a 3 table
    > structure. eg
    >
    > Products:
    > ProductID
    > Product
    >
    > Categories:
    > CategoryID
    > Category
    >
    > ProductCategories:
    > ProductID
    > CategoryID
    >
    > So, from the table ProductCategories, a product can
    belong to many
    > categories. When doing a front end search to find
    products in multiple
    > categories, products can be shown thus:
    >
    > select * from Products where ProductID in (select
    ProductID from
    > ProductCategories where CategoryID in (5,44))
    >
    > --
    > Jules
    >
    http://www.charon.co.uk/charoncart
    > Charon Cart 3
    > Shopping Cart Extension for Dreamweaver MX/MX 2004
    >
    >
    >
    >
    >

  • SP2-0042: unknown command "UNION" - rest of line ignored.

    I used sql script for creating DB structure on Oracle 8 with no errors.
    I got "SP2-0042: unknown command "UNION" - rest of line ignored" error on Oracle 9i.
    Do you anybody tell me whats wrong ?

    Sorry, I had technical problems to access this formu to response.
    My script (part):
    CREATE VIEW ARVALUE
    AS
    SELECT IDVALUE FROM DBVALUE;
    CREATE VIEW AWVALUE
    AS
    SELECT DBVALUE.IDVALUE FROM DBVALUE, AWOBJECT
    WHERE DBVALUE.IDOBJECT = AWOBJECT.IDOBJECT;
    CREATE VIEW BSOBJECTUSAGE
    AS
    SELECT IDOBJECT_CHILD AS IDOBJECT, IDOBJECT_PARENT AS REFERRER
    FROM OBJECTREF
    WHERE OBJECTREF.ACTIVE <> 0
    UNION
    SELECT IDOBJECT_TEMPLATE AS IDOBJECT, IDOBJECT AS REFERRER
    FROM DBVALUE
    WHERE (DBVALUE.ACTIVE <> 0) AND (STORAGETYPE = 2)
    UNION
    SELECT IDOBJECT_DIAGEXT AS IDOBJECT, IDOBJECT AS REFERRER
    FROM DBVALUE
    WHERE (DBVALUE.ACTIVE <> 0) AND (STORAGETYPE = 5);
    Log file (part)
    View created.
    View created.
    SP2-0042: unknown command "UNION" - rest of line ignored.
    SP2-0042: unknown command "UNION" - rest of line ignored.
    no rows selected
    View created.
    if I understand, better
    is:
    CREATE VIEW BSOBJECTUSAGE
    AS
    SELECT IDOBJECT_CHILD AS IDOBJECT, IDOBJECT_PARENT AS REFERRER
    FROM OBJECTREF
    WHERE OBJECTREF.ACTIVE <> 0
    UNION SELECT IDOBJECT_TEMPLATE AS IDOBJECT, IDOBJECT AS REFERRER
    FROM DBVALUE
    WHERE (DBVALUE.ACTIVE <> 0) AND (STORAGETYPE = 2)
    UNION SELECT IDOBJECT_DIAGEXT AS IDOBJECT, IDOBJECT AS REFERRER
    FROM DBVALUE
    WHERE (DBVALUE.ACTIVE <> 0) AND (STORAGETYPE = 5);

  • Strange SP2-0042: unknown command in sqlplus

    Hello everyone,i was attemptting to execute a sql statement from an external file. But i got "SP2-0042: unknown command "ï»? - rest of line ignored.". It's works with ANSI but can not based on UTF8 encoding.My file only contains as following :
    spo db_changesfff.log
    SPO OFF
    Anyone has ideas?thanks in advance!!

    We had this problem as well and we noticed that the script file that contained the UTF-8 had two FF FE magic numbers at the beginning of the file. View your file in HEX mode of your text editor and verify that a single FF FE is at the beginning of the file. We created our UTF-8 file using Notepad. This seems to put two FF FE's in the file header. When we removed one set of FF FE, everything worked just fine.

  • SQL Report with 1 updatable column - help urgent

    Hi,
    I have a SQL report. I am using collection to store value of selected record by link column.
    I have a updatable text item (NULL) in the column. I am able to store that value in the collection.
    Any clue?
    Code
    1. Creating a collection in parent page:
    apex_collection.create_or_truncate_collection
    (p_collection_name => 'ORDER');
    2. Query to populate item rows with option to key 'QTY' before pressing 'Add to Order' link.
    select
    itemcode,
    description,
    NULL AS qty,
    'Add to Order' add_to_order
    from itemtab
    3. Made 'QTY' to Text item -- to allow users to key value
    4. Created 'hidden & protected' items P1_ITEMCODE, P1_QTY
    5. Set values of itemcode, qty in add_to_order link
    6. Created a process to add values into collection:
    for x in (select * from itemtab where itemcode = :P1_ITEMCODE)
    loop
    apex_collection.add_member(p_collection_name => 'ORDER',
    p_c001 => x.ITEMCODE,
    p_c002 => x.DESCRIPTION,
    p_c003 => :P1_QTY
    end loop;
    7. Display value of itemcode, description, qty in report region
    select c001, c002, c003
    from apex_collections
    where collection_name = 'ORDER'
    Probem: The value of qty is not being stored in the collection and not appearing in the #7 report. itemcode and description values are fine.
    Thanks,
    Dip

    Dip,
    I'm guessing here as I can't see your application, I think your missing the page process to collect the data from your QTY field.
    I created a quick demo of what i think your trying to achieve on apex.oracle.com
    http://apex.oracle.com/pls/apex/f?p=19923:2
    I added this to the html expression on the report Field add to:
    <input type="button" onclick="doSubmit(#RANDOM_ID#)" value="Add To" />
    Then the page process to collect and set the page item:
    DECLARE
    l_qty number;
    BEGIN
    FOR i in 1..APEX_APPLICATION.G_F03.COUNT LOOP
    l_qty := nvl(APEX_APPLICATION.G_F03(i),0);
    IF l_qty > 0
    THEN
    :P2_QTY := l_qty;
    :P2_RANDOM_ID := :REQUEST;
    EXIT;
    END IF;
    END LOOP;
    END;
    Let me know if this helps
    Mark
    Don't forget to mark reply as helpful or correct as this may help others reading this thread in the future!
    Edited by: cptbutcher on Mar 25, 2010 10:40 PM

  • JDBC, SQL-SELECT: Aliases for multiple columns?

    Folks;
    using SQL, JDBC with MaxDB 7.6, I am used to doing something like
    SELECT A AS FOO_A, B AS FOO_B, C AS BAR_C FROM FOO, BAR WHERE ...
    in order to make table columns have names sometimes more "meaningful" than in the actual database scheme. In a give environment, I will have to do a
    SELECT * FROM FOO,BAR WHERE ...
    with the difficulty that FOO and BAR contain columns of the same name, yet they both contain too many columns to actually enumerate/alias each one of them manually. Playing around trying something like
    SELECT FOO.* AS FOO_*, BAR.* AS BAR_* FROM FOO,BAR WHERE ...
    of course didn't work, and browsing the web I found there is no "standard SQL" way of doing something like this. Using
    java.sql.ResultSet
    provides a
    getMetaData()
    method which allows for determining the "table name" for a given column in the fetched result set, but unfortunately, the outcome returned by this method always seems to be empty. So to ask:
    - Is there any way in MaxDB-SQL to allow for "aliasing multiple columns"?
    - Alternatively, is there a way to make an SQL query joining multiple tables in MaxDB issued through JDBC generally return table columns in a <tablename>.<columnname> rather than just <columnname> style?
    Thanks a bunch in advance, best regards.
    Kristian

    HI Kristian,
    afaik the resultset.getMetaData() method should provide a MetaData-object that in turn implements methods like getColumnCount() or getColumnName() etc...
    Can you provide a piece of code to demonstrate that this is not working?
    I just tested DB Studio and Squirrel SQL (both use JDBC to connect to the database) and both are able to correctly figure out the structure of the result set for a query like yours.
    Anyhow, the whole requirement is not supposed to be supported.
    In fact, it's already a kind of 'glitch' that results with non-unique columnnames are actually produced, since relational theory forbids such results.
    That's also the reason for why you cannot further work with such a resultset (e.g. use it in a join).
    Therefore, no workaround in place here.
    If you´re going to have a query like this rather often, you may think about using views and define the aliases there only once.
    And besides all this, if you've got many duplicate column names it might also be a unlucky data design.
    best regards,
    Lars

  • SQL SELECT with GROUP BY: Retrieve records for a list of customers

    I need to write a SQL statement to retrieve a list of customers, which are in two tables of different natures, say T1 and T2.
    The customer is a FK in both tables. Both tables have a column which is the date of an order.
    INPUT:
    * list of customers, say '12345, 34567, 45678'
    OUTPUT
    * REF CURSOR to a recordset containing: {custID, startDate, endDate}
    Algorithm
    * For each customer, find the date of first order (from T1 and T2)
    * For that date, t0, startDate=t0-10 days; endDate := t0+15 days;
    I have a feeling some GROUP BY is involved to do the trick.
    Can it be done without any looping? I am just not experienced enough to solve this in an optimal way.
    Any help, please?
    Thank you.

    Hi,
    I'm not sure what your data is, or shat you want for output.
    If your tables can have many rows for the same customer_id, but your output should have only one row per customer_id, then it sounds like you do need to "GROUP BY custiomer_id".
    If the data is coming from two different tables, first do a UNION of those two tables in a sub-query (like union_data below), and then do a GROUP BY on the results of the sub-query.
    It will probably be more efficient if you GROUP BY in the sub-query, too.
    I believe you need something like this:
    WITH     union_data     AS
         SELECT       customer_id
         ,       MIN (order_date)     AS start_dt
         FROM       t1
         WHERE       customer_id     IN (12345, 34567, 45678)
         GROUP BY  customer_id
    UNION ALL
         SELECT       customer_id                    -- column names may be different from t1
         ,       MIN (order_date)     AS start_dt
         FROM       t2
         WHERE       customer_id     IN (12345, 34567, 45678)
         GROUP BY  customer_id
    SELECT       customer_id
    ,       MIN (start_date)      AS start_date
    ,       MIN (start_date) - 10      AS t0
    ,       MIN (start_date) + 5      AS end_date
    FROM       union_data
    GROUP BY  customer_id;If you need help, post a little sample data (CREATE TABLE and INSERT statements for both tables, relevant columns only), and the results you want to get from that data.

  • SQL Help with change multiple columns into a single column

    I am wanting to create either a new View or a new Table based on the following original table:
    Original Table:
    Fiscal Year
    Account
    Budget_Amt_January
    Budget_Amt_February
    Budget_Amt_March
    Budget_Amt_April
    <etc. for each of the 12 months)
    I want the new View or Table to instead be:
    New:
    Fiscal_Year
    Month
    Account
    Budget_Amount
    I can't simply drop the original table, it will have to always exist since it is part of the Finance package, but for ease of reporting against I am wanting to create this new View.
    Any ideas on how to go about this?
    Thanks!

    I had to do something very similar just this week - in my case a record read from a csv into a table, then needs loading into a destination table, and the rows are columns in the csv. I went for INSERT ALL as I also had some conditions.
      INSERT ALL
        WHEN low1 != -998 OR high1 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 1, low1, high1 )
        WHEN low2 != -998 OR high2 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 2, low2, high2 )
        WHEN low5 != -998 OR high5 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 5, low5, high5 )
        WHEN low6 != -998 OR high6 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 6, low6, high6 )
        WHEN low7 != -998 OR high7 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 7, low7, high7 )
        WHEN low8 != -998 OR high8 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 8, low8, high8 )
        WHEN low9 != -998 OR high9 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 9, low9, high9 )
        WHEN low10 != -998 OR high10 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 10, low10, high10 )
        WHEN low11 != -998 OR high11 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 11, low11, high11 )
        WHEN low12 != -998 OR high12 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 12, low12, high12 )
        WHEN low13 != -998 OR high13 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 13, low13, high13 )
        SELECT * FROM bulk_search_load bst, partial_details_temp pdt
        WHERE id = case_number -- only retrieves details for those records that are found in bulk_search_load
        AND filename like 'NETH\_%' escape '\'
        AND processed = 'N'; 

  • SP2-0042: unknown command "end" - rest of line ignored.

    Hi All, below is my code..
    set timing on
    begin
    Delete PB_SURVEY_USER_IMA where Name != 'Login ID';
    Delete PB_SURVEY_USER_IMA where value not like '%@%';
    #Delete PB_SURVEY_USER_IMA where lower(value) like lower('%@pb.com');
    Update PB_SURVEY_USER_IMA
    Set Id = 10557,
    CAN = (      Select Max( account_number)
              from pbaccount
              where member_id in (
                   Select users_id
                   from userreg
                   where userreg.logonid = trim(PB_SURVEY_USER_IMA.value))
    commit;
    Update PB_SURVEY_USER_IMA Set country_id=(Select language_id from users where users_id in (Select users_id from userreg where userreg.logonid = trim(PB_SURVEY_USER_IMA.value)));
    commit;
    end;
    exit;

    Hi,
    This forum is for problems using SQL*Developer and not general SQL or PL/SQL problems.
    It would be better if you opened a new thread in the forum -
    Forum: SQL and PL/SQL
    PL/SQL
    Regards,
    Mike

  • SP2-0042: unknown command " ■c" - rest of line ignored.

    On a 64bit install of oracle, i'm trying to run a script within sqlplus such as @c:/create.sql
    however when i run that, somehow it seems the @ sign as a ■ and screws up my script execution. Has anyone seen this before?

    This is my script that runs everywhere but 64bit:
    prompt *** DROP TABLES ***
    drop table STOCK;
    drop table LEDGER;
    prompt *** CREATE TABLES ***
    prompt LEDGER
    create table LEDGER
         ActionDate DATE,
         Action VARCHAR2(8),
         Item VARCHAR2(30),
         Quantity NUMBER,
         QuantityType VARCHAR2(10),
         Rate NUMBER,
         Amount NUMBER(9,2),
         Person VARCHAR2(25)
    prompt STOCK
    create table STOCK
         Company VARCHAR2(20),
         Symbol VARCHAR2(6),
         Industry VARCHAR2(15),
         CloseYesterday NUMBER(6,2),
         CloseToday NUMBER(6,2),
         Volume NUMBER
    and when i run it i get an error when it's trying to create the table. It seems as if it doesn't understand what i'm trying to tell it.

  • WITH clause: SP2-0734:

    Hello. Got a problem with the WITH clause in SQL*Plus (sqlplus.exe), can't see why this happens.
    12:48:49 RAY@CNRTEST1> select * from v$version;
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    Tried running my large sql statement, which has the WITH clause. This fails with ORA-00933: at the SELECT keyword.
    So, to prove a point, I connect as SCOTT/TIGER, and try a simple WITH clause, and hit <Return> expecting a line 2 to appear:
    12:00:19 RAY@CNRTEST1> with e1 as (select count(*) from emp)
    but get this error:
    SP2-0734: unknown command beginning "with e1 as..." - rest of line ignored.
    However, if I run this using sqlplusw.exe, it runs fine.
    Is there some environment setting I've missed in sqlplus.exe? Any suggestions appreciated.

    Hi,
    With clause it's valid for Oracle 9i release 2 and beyond. You must add Select clause to use it.
    WITH
    subquery_name
    AS
    (the aggregation SQL statement)
    SELECT
    (query naming subquery_name);Regards,

  • SP2-0734 while creating database

    hi
    i have a initdev.ora file as below
    initdev.ora
    db_name = DEV
    db_block_size = 8192
    db_files = 200
    compatible = 9.2.0.1.0
    db_file_multiblock_read_count = 32
    db_block_buffers = 9600
    shared_pool_size =40000000
    SORT_AREA_size=4096000
    log_checkpoint_interval = 10000
    processes = 200
    dml_locks = 500
    log_buffer = 196608
    audit_trail = DB
    max_dump_file_size = 10240
    log_archive_start = true
    log_archive_dest = E:\ARCH_DEV
    log_archive_format = "ARC%S.%T"
    ROLLBACK_SEGMENTS=(RBCKINIT, RBCK64K_1, RBCK64K_2, RBCK64K_3, RBCK64K_4, RBCK64K_5,RBCK128K_1, RBCK128K_2, RBCK128K_3, RBCK128K_4, RBCK128K_5, RBCKBIG_1, RBCKBIG_2, RBCKHUGE_1)
    global_names = FALSE
    open_cursors = 400
    background_dump_dest = E:\ORACLE\ORA92\dev\bdump
    user_dump_dest = E:\ORACLE\ORA92\dev\udump
    control_files = (E:\ORACLE\ORA92\DEV\CTL1NEWA.CTL, E:\ORACLE\ORA92\DEV\CTL2NEWA.CTL)
    remote_login_passwordfile = shared
    utl_file_dir = e:\utl_dev
    i am using following SQL to create controlfile..etc
    recr_con.sql
    STARTUP NOMOUNT pfile=e:\oracle\ora92\dev\pfile\initdev.ora
    CREATE CONTROLFILE SET database "DEV" RESETLOGS FORCE LOGGING ARCHIVELOG
    -- SET STANDBY TO MAXIMIZE PERFORMANCE
    MAXLOGFILES 254
    MAXLOGMEMBERS 5
    MAXDATAFILES 200
    MAXINSTANCES 1
    MAXLOGHISTORY 907
    LOGFILE
    GROUP 1 (
    'E:\oracle\ora92\dev\NEWA1A.RDO',
    'E:\oracle\ora92\dev\NEWA1B.RDO'
    ) SIZE 5000K,
    GROUP 2 (
    'E:\oracle\ora92\dev\NEWA2A.RDO',
    'E:\oracle\ora92\dev\NEWA2B.RDO'
    ) SIZE 5000K,
    GROUP 3 (
    'E:\oracle\ora92\dev\NEWA3A.RDO',
    'E:\oracle\ora92\dev\NEWA3B.RDO'
    ) SIZE 5000K,
    GROUP 4 (
    'E:\oracle\ora92\dev\NEWA4A.RDO',
    'E:\oracle\ora92\dev\NEWA4B.RDO'
    ) SIZE 5000K
    -- STANDBY LOGFILE
    DATAFILE
    STARTUP NOMOUNT pfile=e:\oracle\ora92\dev\pfile\initdev.ora
    CREATE CONTROLFILE SET database "DEV" RESETLOGS FORCE LOGGING ARCHIVELOG
    -- SET STANDBY TO MAXIMIZE PERFORMANCE
    MAXLOGFILES 254
    MAXLOGMEMBERS 5
    MAXDATAFILES 200
    MAXINSTANCES 1
    MAXLOGHISTORY 907
    LOGFILE
    GROUP 1 (
    'E:\oracle\ora92\dev\NEWA1A.RDO',
    'E:\oracle\ora92\dev\NEWA1B.RDO'
    ) SIZE 5000K,
    GROUP 2 (
    'E:\oracle\ora92\dev\NEWA2A.RDO',
    'E:\oracle\ora92\dev\NEWA2B.RDO'
    ) SIZE 5000K,
    GROUP 3 (
    'E:\oracle\ora92\dev\NEWA3A.RDO',
    'E:\oracle\ora92\dev\NEWA3B.RDO'
    ) SIZE 5000K,
    GROUP 4 (
    'E:\oracle\ora92\dev\NEWA4A.RDO',
    'E:\oracle\ora92\dev\NEWA4B.RDO'
    ) SIZE 5000K
    -- STANDBY LOGFILE
    DATAFILE
    'E:\oracle\ora92\dev\INDXNEWA.NEWA',
    'E:\oracle\ora92\dev\VACCIMM.DB2',
    'E:\oracle\ora92\dev\USERNEWA.DB2',
    'E:\oracle\ora92\dev\TOOLNEWA.DB2',
    'E:\oracle\ora92\dev\SYSNEWA.DB2',
    'E:\oracle\ora92\dev\SPECNEED.DB2',
    'E:\oracle\ora92\dev\SCREENS.DB2',
    'E:\oracle\ora92\dev\RESULTS.DB2',
    'E:\oracle\ora92\dev\REGISTR1.DB2',
    'E:\oracle\ora92\dev\RBCKNEWA.DB2',
    'E:\oracle\ora92\dev\PSHCSHL.DB2',
    'E:\oracle\ora92\dev\PROTECT.DB2',
    'E:\oracle\ora92\dev\PRINTING.DB2',
    'E:\oracle\ora92\dev\LOOKUPS.DB2',
    'E:\oracle\ora92\dev\HISTORIC.DB2',
    'E:\oracle\ora92\dev\DIAGNOSE.DB2',
    'E:\oracle\ora92\dev\DEVELOP.DB2',
    'E:\oracle\ora92\dev\COMMUNITY.DB2',
    'E:\oracle\ora92\dev\CMDS.DB2',
    'E:\oracle\ora92\dev\CHINDEX4.DB2',
    'E:\oracle\ora92\dev\CHINDEX3.DB2',
    'E:\oracle\ora92\dev\CHINDEX2.DB2',
    'E:\oracle\ora92\dev\CHINDEX1.DB2',
    'E:\oracle\ora92\dev\CHINDEX0.DB2',
    'E:\oracle\ora92\dev\CHLLD.DB2',
    'E:\oracle\ora92\dev\CGENERAL.DB2',
    'E:\oracle\ora92\dev\APPOINTS.DB2',
    'E:\oracle\ora92\dev\ADMINIST.DB2',
    'E:\oracle\ora92\dev\ADDRESS.DB2',
    'E:\oracle\ora92\dev\ACTIVITY.DB2',
    'E:\oracle\ora92\dev\LOOKUPS2.DB1',
    'E:\oracle\ora92\dev\TEMPNEWA.DB1'
    CHARACTER SET WE8ISO8859P1
    ALTER database OPEN RESETLOGS;
    CHARACTER SET WE8ISO8859P1
    ALTER database OPEN RESETLOGS;
    Following is error
    SP2-0734: unknown command beginning "CHARACTER ..." - rest of line ignored.
    any suggestions
    thax
    kedar

    Could you get rid of the extra line?
    'E:\oracle\ora92\dev\TEMPNEWA.DB1'
    CHARACTER SET WE8ISO8859P1
    ;Make it
    'E:\oracle\ora92\dev\TEMPNEWA.DB1'
    CHARACTER SET WE8ISO8859P1
    ;

  • Why do I get a class conflict between the Prepare SQL.vi and the Get Column Name.vi with the SQL Toolkit compatibility vis from the Database Connectivity Toolkit?

    I have done extensive programming with the SQL Toolkit with LabVIEW versions through 6.1. My customer now wants to upgrade to Windows 7, so I am trying to upgrade to LabVIEW 2009 (my latest purchased version) using the Database Connectivity Toolkit, and the SQL Toolkit Compatibility vis. Everything seemed to be going okay with the higher level SQL operations, but I ran into trouble with the Get Column Name.vi. 
    The pictures below show the problem. The original SQL Toolkit connected the Prepare SQL.vi with the Get Column Name.vi with a cluster of two references, one for connection, and one for sql. The new compatibility vis have a class conflict in the wire because the Prepare SQL.vi contains a cluster with connection, and command references, but the Get Column Name.vi expects a cluster with connection and recordset references. 
    How do I resolve this conflict?
    Thank You.
    Dan

    I've never worked with the old version of the toolkit, so I don't know how it did things, but looking inside the SQL prep VI, it only generates a command, and the the column name VI wants a recordset. I'm not super familiar with all the internals of ADO, but my understanding is that is standard - you only have the columns after you execute the command and get the recordset back. What you can apparently do here is insert the Execute Prepared SQL VI in the middle and that will return what you need.
    I'm not sure why it worked before. Maybe the execute was hidden inside the prep VI or maybe you can get the column names out of the command object before execution. In general, I would recommend considering switching to the newer VIs.
    Try to take over the world!

  • SEQUENCE Select within an SQL Query with an ORDER BY statement

    Does anyone know why you cannot use an ORDER BY statement within an SQL query when also selecting from a SEQUENCE? My query was selecting production data as a result of a filtered search. I want to take the results of the filtered search and create a transaction. I have a sequence for generating transaction numbers where I select NEXTVAL. Since I could possibly obtain multiple, yet distinct, rows based upon my search criteria, I wanted to use an ORDER BY statement to simplify and order the resulting row(s).
    I was able to get the SQL select with SEQUENCE.NEXTVAL to work without the ORDER BY, so I know that my SQL is correct. Thanks in-advance.

    Okay,
    I understand. You want the sequence assigned first and the you want to ORDER BY. You
    can do this using pipelined functions. See here:
    CREATE OR REPLACE TYPE emp_rec_seq AS OBJECT (
       seq     NUMBER,
       ename   VARCHAR2 (20),
       job     VARCHAR2 (20),
       sal     NUMBER
    CREATE OR REPLACE TYPE emp_tab_seq AS TABLE OF emp_rec_seq;
    CREATE OR REPLACE FUNCTION get_emp_with_sequence
       RETURN emp_tab_seq PIPELINED
    IS
       my_record   emp_rec_seq := emp_rec_seq (NULL, NULL, NULL, NULL);
    BEGIN
       FOR c IN (SELECT dummy.NEXTVAL seq, ename, job, sal
                   FROM emp)
       LOOP
          my_record.seq := c.seq;
          my_record.ename := c.ename;
          my_record.job := c.job;
          my_record.sal := c.sal;
          PIPE ROW (my_record);
       END LOOP;
       RETURN;
    END get_emp_with_sequence;after that, you can do a select like this:
    SELECT seq, ename, job, sal
      FROM TABLE (get_emp_with_sequence)
      order by enamewhich will get you this:
           SEQ ENAME                JOB                         SAL
          1053 BLAKE                MANAGER                    2850
          1054 CLARK                MANAGER                    2450
          1057 FORD                 ANALYST                    3000
          1062 JAMES                CLERK                       950
          1055 JONES                MANAGER                    2975
          1052 KING                 MANAGER                   20000
          1060 MARTIN               SALESMAN                   1250
          1063 MILLER               CLERK                      1300
          1064 DKUBICEK             MANAGER                   12000
          1056 SCOTT                ANALYST                    3000
          1058 SMITH                CLERK                       800
          1061 TURNER               SALESMAN                   1500
          1059 WARD                 SALESMAN                   1250Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

Maybe you are looking for

  • Eps files not showing up in FM

    Hi, I made an eps file in Illustrator, and when I import it into FM I get an empty box.  I've included a screen shot of my eps options.   What am I doing wrong?   I just updated to a new computer.  It's the same CS6 software.  Windows 7.

  • Project def. description & WBS description in multiple language

    Hi Guru's, In my current project client want to maintain Project def. description & WBS description in English and Arabic simultaneously( but not as long text). Is it possible to maintain two description together( 1st in English and other 2nd in Arab

  • Active new general  ledger accounting

    Dear all, We use SAP several years, after we upgrade to ECC5.0, I would like to active new general ledger accounting. In the SAP training material (AC210), it said that this action should be performed at new year, not mid-year. however, if I active i

  • Forms 10G -- UI Control Features

    Hello: Where can I find the list of UI Control parameters that we can set in Forms? We can set LOVButton, RequireFieldVA, Font/Size properties in “Registry.dat”. Are there any additional once that we can set? We are primarily looking for Color of Pro

  • RoboHelp Output

    I'm not sure if my posts are getting to the right people, but I'll try again. Since .chm files cannot be accessed via a network, it's a major problem for us since we cannot "install" these help file(s) on our clients' machines.  What information we h