ORA-04044 Error in SQL statement

Hi All,
I faced ORA-04044 in a SQL statement being written inside a shell script. I really don't know what is wrong with the script. Without shell variables is working ...
Here is the excerpt:
line=`sar -u 2 5 |tail -1`
var_io=`echo "$line" | awk '{print $6}'`
var_sys=`echo "$line" | awk '{print $5}'`
var_user=`echo "$line" | awk '{print $3}'`
var_idle=`echo "$line" | awk '{print $7}'`
sqlplus $ora_access <<EOF
select sysdate, a.hostid, a.inst_num, b.count1, c.count2, $var_user,$var_sys,$var_idle,$var_io
from dual ,
(select HOST_NAME hostid, INSTANCE_NUMBER inst_num from v$instance ) a,
(select count(sid) count1 from v$session where username is not null) b,
(select count(*) count2 from apps.fnd_concurrent_requests where phase_code ='R') c;
EOF
[b]Error Message:
SQL*Plus: Release 10.2.0.2.0 - Production on Thu Apr 10 02:20:53 2008
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> 2 3 4 5 (select count(sid) count1 from v where username is not null) b,
ERROR at line 4:
ORA-04044: procedure, function, package, or type is not allowed here

Thanks a lot for instant reply. It worked!!
I forgot to use the escape character, but the error
message was not revealing anything :-(If you look carefully you could have spotted it:
SQL> 2 3 4 5 (select count(sid) count1 from[b] v where username is not null) b,

Similar Messages

  • Error executing SQL statement

    Hi,
    Can anyone see why I am getting this error message for my SQL query?
    WITH SKU_DATA AS (
    SELECT /*+ MATERIALIZE */ DISTINCT FROM_LOC_ID,
               SKU_ID,
               DESCRIPTION,
               UPDATE_QTY,
            ORDER_ID,
            CONSIGNMENT,
               WEIGHT,
            PALLET_ID,
            CASE 
        WHEN Upd_Qty_Ratio < 1
        THEN TO_CHAR(UPDATE_QTY) || 'U'
        WHEN TRUNC(Upd_Qty_Ratio) = Upd_Qty_Ratio
        THEN TO_CHAR(Upd_Qty_Ratio) || 'C'
        ELSE TO_CHAR(TRUNC(UPDATE_QTY)) || 'C' || ' ' || TO_CHAR(ROUND(MOD(Upd_Qty_Ratio, 1) *  USER_DEF_NUM_3, 6)) || 'U'
        END CU_Sum
        FROM (
      SELECT DISTINCT
             FROM_LOC_ID,
          S.SKU_ID,
             S.DESCRIPTION,
             ITL.UPDATE_QTY,
             S.USER_DEF_NUM_3,
          OH.ORDER_ID,
          ITL.CONSIGNMENT,
          ITL.PALLET_ID,
             NVL(ITL.UPDATE_QTY,0)*NVL(S.EACH_WEIGHT,0) Weight,
             ITL.UPDATE_QTY/(CASE S.USER_DEF_NUM_3 WHEN 0 THEN 1 ELSE S.USER_DEF_NUM_3 END) Upd_Qty_Ratio
        FROM INVENTORY_TRANSACTION ITL, SKU S, LOCATION L, ORDER_HEADER OH
        WHERE ITL.SKU_ID = S.SKU_ID
        AND ITL.CODE = 'Pick'
        AND ITL.CONSIGNMENT = $P{Consignment}
        AND OH.ORDER_DATE = TO_CHAR($P{Date}, 'DD-Mon-YYYY')
        AND OH.ORDER_ID = ITL.REFERENCE_ID
        AND ITL.TO_LOC_ID = 'CONTAINER'))
    SELECT DISTINCT ORDER_ID, CONSIGNMENT, WEIGHT, PALLET_ID, CU_Sum,
    (SELECT NVL(TO_CHAR(SUM(CASE WHEN NULLIF(SUBSTR(Cu_Sum, -1), 'U') IS NULL THEN NULL ELSE REPLACE(Cu_Sum,'C',NULL) END)),'0') ||'C' || ' ' || NVL(TO_CHAR(SUM(CASE WHEN NULLIF(SUBSTR(Cu_Sum, -1), 'C') IS NULL THEN NULL ELSE REPLACE(Cu_Sum,'U',NULL) END)),'0') ||'U' FROM SKU_DATA) AS Total_Cu_Sum
    FROM SKU_DATAThanks in advance.
    SM.

    Hi Sean,
    It is saying error executing SQL statement, but with no "ORA error" so maybe its a Jasper Reports error i'm not too sure.
    And this is a different version of the one we done together, that one is running fine just having problems putting the jasper file on to the server. I'm just using the main bits from the original SQL.
    SM

  • RMAN-10006: error running SQL statement: alter session set remote_dependenc

    Backups are failing with following error
    RMAN-00554: initialization of internal recovery manager package failed
    RMAN-12001: could not open channel default
    RMAN-10008: could not create channel context
    RMAN-10002: ORACLE error: ORA-00096: invalid value SIGNATURE for parameter remote_dependencies_mode, must be from among MANUAL, AUTO
    RMAN-10006: error running SQL statement: alter session set remote_dependencies_mode = signature
    Not able to change to signature
    SQL> alter session set remote_dependencies_mode=signature;
    ERROR:
    ORA-00096: invalid value SIGNATURE for parameter remote_dependencies_mode, must
    be from among MANUAL, AUTO
    I dont see MANUAL or AUTO as valid value for this parameter (http://download.oracle.com/docs/cd/B10501_01/server.920/a96536/ch1175.htm#1023124) DB version is 9.2.0
    Parameter type
    String
    Syntax
    REMOTE_DEPENDENCIES_MODE = {TIMESTAMP | SIGNATURE}
    Default value
    TIMESTAMP
    Parameter class
    Dynamic: ALTER SESSION, ALTER SYSTEM
    =======================================
    I believe it could be because of following bug
    "A PRE-PATCHED ORACLE IMAGE CAN BE INSTALLED IN MEMORY "
    Refer: "https://metalink2.oracle.com/metalink/plsql/f?p=130:15:1613505143885559758::::p15_database_id,p15_docid,p15_show_header,p15_show_help,p15_black_frame,p15_font:BUG,4610411,1,1,1,helvetica"
    I appreciate your effort in fixing this issue.
    Edited by: user10610722 on Nov 25, 2008 4:37 PM

    Hi:
    It seems when you are starting RMAN it's executing some commands (one 'ALTER SESSION...'. It's seems to be a batch which has a bad value for SORT_AREA_SIZE. Find it and modify to a proper value as message shows. If you can't find start RMAN by calling directly the executable ($ORACLE_HOME/bin/rman or %ORACLE_HOME%/bin/rman.exe).

  • ORA-01555 caused by SQL statement below - Kindly assist

    Hi,
    Version 9.2.0.7
    I have been getting lots of ORA-01555 error logged into my alert log since 10 hours ago, happening every second till now.
    The ORA-01555 is strange compared to those that have occured in my database before. From the error logged into the alert log, the statement is reflected as "table_4_200_c432_0_0_0". Any experts can advise what's exactly happening? The duration stated below seems really long.
    ORA-01555 caused by SQL statement below (Query Duration=1225798260 sec, SCN: 0x077a.e8ab9ae8):
    Tue Nov 4 19:31:00 2008
    table_4_200_c432_0_0_0
    thanks

    That event trace is helpful only when you are getting ORA-01555 in trace files without a query.
    Of course, you cannot get the diagnostic information for something that occurred in past (when diagnostics were not in place); so you have to wait till the next occurrence (if any) of ORA-01555 under similar conditions.

  • ORA-01555 caused by SQL statement below

    Dear all,
    How can I treat this error ?
    ORA-01555 caused by SQL statement below (SQL ID: 9kh4f608ty7un, Query Duration=88767 sec, SCN: 0x0000.db7b3cef): : Category 1
    Any ideas ? I did not touch the DB, so I am not sure why it came.
    Thanks in advance,
    Daniel.

    hi Daniel,
    You have to mentioned step by step solution (SQL statement) which you perform to resolve this issue.I am saying this for those sdn new users who have no S-user or access of SAP note.
    Thanks and Regards,
    majamil
    Danke???

  • Error in SQL Statement: SAPSQL_INVALID_FIELDNAME F~/BIC/ZREVISQTY

    Dear Guys,
                    Regards..In the "Listcube" transaction and "Manage Contents" of the cube,whenver i execute the transaction to get the 'Output List' ,i get the following error : " Error in SQL Statement : SAPSQL_INVALID_FIELDNAME"..with the following obj : ZREVISQTY............But when i remove the "ZREVISQTY" from the selection screen in both "LISTCUBE" and "MANAGE" of the cube,the output works fine......It would be great if somone can throw light on this...........
    Manythanks
    Arun

    Dear Guys,
                    Regards..In the "Listcube" transaction and "Manage Contents" of the cube,whenver i execute the transaction to get the 'Output List' ,i get the following error : " Error in SQL Statement : SAPSQL_INVALID_FIELDNAME"..with the following obj : ZREVISQTY............But when i remove the "ZREVISQTY" from the selection screen in both "LISTCUBE" and "MANAGE" of the cube,the output works fine......It would be great if somone can throw light on this...........
    Manythanks
    Arun

  • Error in SQL Statement: SAPSQL_INVALID_TABLENAME

    Hello all,
    While displaying contents of infocube i am getting strange error ..
    Error in SQL Statement: SAPSQL_INVALID_TABLENAME ABC
    Message no. DBMAN256
    ( Table name length is 16 )
    I am able to see the contents of Fact table.
    Could not found any solution till now.. Any lights , views will be very much helpful.
    Regards
    Nimesh

    hi Nimesh,
    check oss note 835816
    Symptom
    When you execute a query, a data-mart, SEM, APO or similar access, an SQL error 4004 occurs "Unknown table name" Open SQL: Short dump with UNCAUGHT_EXCEPTION CX_RSR_X_MESSAGE in the ABAP Call Stack, you find the RSDRC_BASIC_DB_QUERY_DATA_GET function module.
    Prior to this, relatively large datasets (more than 10%) were deleted from the InfoCube.
    Other terms
    Business Information Warehouse, Factview, DBMAN256, DBMAN
    256, SAPLRSDRS, DELETE, DELETE_FACTS, RSDRD_DELETE_FACTS
    Reason and Prerequisites
    During the purge, the fact tables are rebuilt again as of a certain percentage, for performance reasons. The factview is then not created again.
    Solution
    Views that are already missing can be compiled again with the SAP_FACTVIEWS_RECREATE report.
    The correction prevents the problem reappearing.
    BW 3.0B
               Import Support Package 27 for 3.0B (BW3.0B Patch27 or SAPKW30B27) into your BW system. The Support Package is available whennote 0723258 with the short text "SAPBWNews BW3.0B Support Package 27", which describes this Support Package in more detail, is released for customers.
    BW 3.10 Content
               Import Support Package 21 for 3.10 (BW3.10 Patch21 or SAPKW31021) into your BW system. The Support Package is available whennote 0723263 with the short text "SAPBWNews BW3.1 Content Support Package 21", which describes this Support Package in more detail, is released for customers.
    BW 3.50
               Import Support Package 13 for 3.5 (BW3.50 Patch13 or SAPKW35013) into your BW system. The Support Package is available when note 0765114 with the short text "SAPBWNews BW Support Package 13 NetWeaver'04  Stack 13", which describes this Support Package in more detail, is released for customers.
    In urgent cases you can use the correction instructions.
    These notes may already be available before the Support Package is released, to make information available in advance. However, the short text then still contains the words "preliminary version".

  • How to resolve ORA-00001 Error in SQL Insert?

    Hi all, I need your appreciated help.
    I make a plsql procedure that is inserting a row according cursor value, I'm having oracle error ORA-00001: unique constraint (constraint_name) violated.
    You may see this message if a duplicate entry exists at a different level: in RDBMS MySQL I have the syntax IGNORE to resolve this duplication error... and in Oracle ?
    Thanks for your time and hints.
    Miguelito

    user6317803 wrote:
    How to resolve ORA-00001 Error in SQL Insert?ORA-00001 means table has unique/primary key/index and you are trying to insert a row with key value that already exists in the table. I'll assume table COUNTRIES has primary key on COUNTRY_ID. Then change SQL to:
    SQL = "INSERT INTO COUNTRIES(COUNTRY_ID,COUNTRY_NAME,REGION_ID) SELECT 'BZ','BLZ',3 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ')"There is a good chance table COUNTRIES also has unique key/index on COUNTRY_NAME. If so use:
    SQL = "INSERT INTO COUNTRIES(COUNTRY_ID,COUNTRY_NAME,REGION_ID) SELECT 'BZ','BLZ',3 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM COUNTRIES WHERE COUNTRY_ID = 'BZ' OR COUNTRY_NAME = 'BLZ')"SY.

  • Report -Error in SQL Statement

    Hi to All,
    Whe I ran the report on ODS its giving the following error.
    Error Error in SQL Statement:DBIF_RSQL_INVALID-RSQL
    Error Error When generating the SQL statement
    Error reading the data of Infoprovider ZABCXX
    Abort system error in Program SAPLRRK0 and form RSRDR;SRRK0F30-01
    Note:ZABCXX is a Multiprovider
    Then I identified data type  is mismatched for 4 characteristics in ODS , I have changed the data type from Date to Char then deleted the data from ODS and reloaded the six Init packages with different selections.
    After reloading I ran the report still same error its showing.
    Is any bug in stadard program?
    Pls can anyody throw some light on my problem.
    Thanks,
    Sha.

    Hi,
    Try using transaction code ListCube and see if you are able to see some entries in BW system itself.
    Also in RSRT -> Query -> Environment -> Delete old abaps
    Also in RSRT -> Query -> Environment -> Generate Queries
    And let us know the outoput .
    Hope that helps.
    Regards
    Mr Kapadia
    Assigning points is the way to say thanks in SDN.

  • SAP BW 3.5 "Error in SQL Statement: DBIF_RSQL_INVALID_RSQL" in Infospoke

    Hi ,
    I am working on SAP BW 3.5.
    while downloading the records through infospoke and giving them to the Application server side, I am getting an error  "Error in SQL Statement: DBIF_RSQL_INVALID_RSQL".
    Daily the Infospoke runs on delta mode. But for downloading of few records i have deactivated the delta and changed it in to Full mode. After downloading the data I again Activated the delta.but while Executing on Background mode I am getting an error mentioned above.
    can anyone please suggest a solution for resolving this error?
    Thanks in advance.
    Santosh.

    Hi:
    Did you do some recent change in the objects?. I face sometimes this error and it is due to misalignment among the objects in a data flow (cubes, DSOs, transformations, DTPs, etc.).
    What you can do is activate everything again.
    Best regards.

  • SQL error, Error in SQL statement

    hi all,
    in our project we are using 0SD_C03. while  i creating aggrigates it's showining "SQL error" and Error in SQL statement.
    please provide me some inputs.
    sasidhar

    check:
    Aggregate issue
    Problems with BITMAPINDEX under ORACLE in BW
    SAP Note Number: 159779
    No 'Star Transformation' for a Hierarchy Changerun
    SAP Note Number: 934281

  • Error in SQL Statement (ODS data loading Error)

    Hello Gurus...
    I am trying to loading the data Info Source To ODS in my ODS Key Figure Z_IVQUA (Invoice Quantity)
    is getting the Error Message Data shows 0 from 0 Records.
    I was Remove the Key Field from ODS Then try to load the data but i am getting same Error..
    Error in SQL Statement: SAPSQL_INVALID_FIELDNAME F~/BIC/Z_INVQUA
    Errors in source system
    Please Suggest....
    Thanks
    Prakash

    Hello All...
    Really appreciate if you can give me some advise. Thanks.
    Prakash
    Edited by: Prakash M on Jan 14, 2009 2:14 PM

  • Error in SQL Statement: SAPSQL_INVALID_TABLENAME /BI0/V0FIGL_C01F

    Hi,
    When I am executing datasource 80FIGL_C01 using T.code RSA3 in BW3.5, getting error Error in SQL Statement: SAPSQL_INVALID_TABLENAME /BI0/V0FIGL_C01F
    I am getting same error when pulling data from BW3.5 to BI7.0 at scheduling.
    Can I have your valuable insights on this.
    Thanks in advance!
    Sapna

    Hi,
    Try the report sap_factviews_recreate. Warning: the program generate the views for all infocubes. When you don't want to do this, debug the abap and delete the infocubes from the table G_T_CUBE.
    Or activate the infocube and re-generate the datasource.
    Sven

  • ORA-01555 caused by SQL statement below on production

    Hi
    i got ORA-01555 caused by SQL statement below on my prodution adn database undo_retention = 18000 what can i do my database performance is going down pls tail me what i do .
    Regards
    Digvijay

    1) I don't see a SQL statement here
    3) How did you determine that UNDO_RETENTION of 18000 was appropriate?
    4) How much UNDO is your system generating?
    6) Do you believe this is related to your performance problems? If so, why do you believe that?
    At the risk of stating the obvious... You've told Oracle to try to maintain UNDO for 18,000 seconds (5 hours). You have a query that runs for roughly 6.25 hours. If, after running for 6.25 hours, that query needs a block that was modified, say, 6 hours ago, it may not find it because you've told Oracle you don't need it any longer.
    Your UNDO_RETENTION needs to be greater than the longest-running query you expect to run. You can bump up UNDO_RETENTION if you'd like. However, I tend to believe that a query that died after 6.25 hours is probably a query that is in desparate need of tuning. If you reduce the query runtime to something less than 5 hours, you could keep UNDO_RETENTION at the current setting.
    Justin

  • Capture Error'd SQL Statement

    Hi Everyone,
    I would like to create an error package say PKG_ERROR that has a procedure say LOG_ERROR. The LOG_ERROR procedure will basically logs the following in a table
    ERROR_ID
    -> SEQ_ERROR_ID.NEXTVAL
    CREATED_DATE
    -> SYSDATE
    HOST_NAME
    -> SELECT sys_context('USERENV', 'HOST') FROM dual;
    IP_ADDRESS
    -> SELECT sys_context('USERENV', 'IP_ADDRESS') FROM dual;
    OS_USER
    -> SELECT sys_context('USERENV', 'OS_USER') FROM dual;
    SESSION_USER
    -> SELECT sys_context('USERENV', 'SESSION_USER') FROM dual;
    SCHEMA_NAME
    -> SELECT sys_context('USERENV', 'CURRENT_SCHEMA') FROM dual;
    ERROR_CODE
    -> SQLCODE
    ERROR_MESSAGE
    -> SQLERRM
    ERROR_STACK
    -> DBMS_UTILITY.FORMAT_ERROR_STACK
    CALL_STACK
    -> DBMS_UTILITY.FORMAT_CALL_STACK
    SQL_STATEMENT
    -> ????
    My problem now is how to get the SQL_STATEMENT that caused the error.
    I'll be using the PKG_ERROR.LOG_ERROR procedure as follows:
    PROCEDURE SP_TEST
    IS
    v_NUMBER NUMBER;
    BEGIN
    SELECT 1 / 0
    INTO v_NUMBER
    FROM DUAL;
    EXCEPTION
    WHEN OTHERS THEN
    PKG_ERROR.LOG_ERROR(param_1, param_N);
    END PROCEDURE SP_TEST;
    I tried numerous codes and place them on the PKG_ERROR.LOG_ERROR procedure but to no avail:
    #1
    -- did not return the ERROR'd SQL Statement
    SELECT q.sql_text
    INTO captured_sql
    FROM gv$sql q, gv$sql_cursor c, gv$session s
    WHERE s.audsid = USERENV('sessionid')
    AND s.prev_sql_addr = q.address
    AND q.address = c.parent_handle;
    #2
    -- Only works in Database Error Trigger (I would like a solution via Package)
    DECLARE
    l_text ora_name_list_t;
    l_n number;
    BEGIN
    dbms_output.put_line( '--------------------' );
    dbms_output.put_line('statment causing error: ' );
    l_n := ora_sql_txt( l_text );
    FOR i in 1 .. nvl(l_text.count,0)
    LOOP
    dbms_output.put_line(l_text(i) );
    END LOOP;
    dbms_output.put_line( 'error text: ' );
    FOR i IN 1 .. ora_server_error_depth
    LOOP
    dbms_output.put_line(ora_server_error_msg(i) );
    END LOOP;
    dbms_output.put_line( '--------------------' );
    END;
    #3
    -- as per PSOUG it is returns the first 4K bytes of the current SQL that triggered the fine-grained auditing event. (I'm not using FGA)
    SELECT sys_context('USERENV', 'CURRENT_SQL') FROM dual;
    Is it possible??
    Thanks,
    Henry Wu

    <My problem now is how to get the SQL_STATEMENT that caused the error.>
    We use a location variable that indicates where in a program the error occurred, something like
      variable v_location_c VARCHAR2(10);
      v_location_c := '1000000000';
      UPDATE ...
    EXCEPTION
      WHEN OTHERS THEN
        log_error('program_name',user,v_location_c, ...)

Maybe you are looking for