ORA-00933 - Error in PL/SQL for Form with report.

Hello,
I am getting this error :
failed to parse SQL query:
ORA-00933: SQL command not properly ended
and my PL/SQL function body returning SQL is as follows:
Declare
q varchar2(32767);
w varchar2(4000);
v_total varchar2(10);
Begin
v_total:='TOTAL' ;
q:=' SELECT ASR_DB_CLIENT.CLIENT_NAME, ';
q:=q||' ASR_DB_OIS.ACCT_NAME, ';
q:=q||' ASR_DB_OIS.ACCT_NBR, ';
q:=q||' ASR_DB_OIS.INCEPT_DT, ';
q:=q||' asr_db_prod.MKT_CODE, ';
q:=q||' asr_db_prod.asst_clss, ';
q:=q||' ASR_DB_OIS.PROD_CODE, ';
q:=q||' ASR_DB_OIS.GROUP_CODE, ';
q:=q||' ASR_DB_PLAN.TAX_STAT, ';
q:=q||' asr_db_clnt_type.clnt_type_name, ';
q:=q||' asr_db_plan_type.plan_type_name, ';
q:=q||' ASR_DB_OIS.ACCT_type, ';
q:=q||' ASR_DB_PLAN.CNTRY_CODE, ';
q:=q||' ASR_DB_OIS.DISCRET_FLAG, ';
q:=q||' ASR_DB_OIS.ASST_BAL ';
q:=q||' FROM ASR_DB_OIS, ASR_DB_PLAN, ASR_DB_CLIENT, ASR_DB_PROD, ';
q:=q||' asr_db_plan_type, ';
q:=q||' asr_db_Clnt_type ';
q:=q||' WHERE';
q:=q||' ASR_DB_OIS.PLAN_ID = ASR_DB_PLAN.PLAN_ID and ';
q:=q||' ASR_DB_OIS.as_of_dt = ASR_DB_PLAN.as_of_dt and ';
q:=q||' ASR_DB_PLAN.CLIENT_ID = ASR_DB_CLIENT.CLIENT_ID and ';
q:=q||' ASR_DB_OIS.as_of_dt = ASR_DB_CLIENT.as_of_dt and ';
q:=q||' asr_db_ois.prod_code = asr_db_prod.prod_code and ';
q:=q||' ASR_DB_PLAN.plan_type_code = ASR_DB_PLAN_type.plan_type_code and ';
q:=q||' ASR_DB_Client.clnt_type_code = ASR_DB_clnt_type.clnt_type_code and ';
q:=q||' ASR_DB_OIS.AS_OF_DT = :p99_asofdate ';
IF :P2_ROLLUPSLEEVE = 'RU'
THEN
q :=q||' and ASR_DB_OIS.PARENT_OIS_ID is null ';
Else
q :=q||' and ASR_DB_OIS.ACCT_TYPE like "%"'||v_total||'"%" ';
q :=q||' and ASR_DB_OIS.PARENT_OIS_ID is not null ';
END IF;
return q;
end;
Why this is failing ?
Is "%"'||v_total||'"%" '; incorrect ?
P2_ROLLUPSLEEVE is a radio button.
Please advise....
Thanks,
HM

And
Also, I get the following error when I try few other things like
q :=q||' and ASR_DB_OIS.ACCT_TYPE = '||v_total||' ';
or
q :=q||' and ASR_DB_OIS.ACCT_TYPE = "||v_total||" ';
failed to parse SQL query:
ORA-00904: "TOTAL": invalid identifier
And
ORA-06550: line 43, column 41: PLS-00103: Encountered the symbol "TOTAL" when expecting one of the following: * & = - + ; < / > at in is mod remainder not rem <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ between || member SUBMULTISET_ The symbol "* was inserted before "TOTAL" to continue.
When I try
q :=q||' and ASR_DB_OIS.ACCT_TYPE = "'TOTAL'" ';
Any helpful tips will be much appreciated.
Thanks,
HM

Similar Messages

  • Additional fields in report for form with report

    Hello,
    I got the problem, that I want to create a form with report where the form only changes the values of one table but the report is also using additional fields linked from another table. If I take a view with all fields for my form with report, the form is about all fields and not only about those from the first table. So is there a way to have another table linked to the form than to the report and get a link between them by a key?
    I hope that someone has got a great idea and can help me solving this.
    Thanks
    Jochen

    Jochen,
    you can create a form with report on the view and afterwards you change the SQL-query into a query on the view. Take care that the original column names remain the same. You get your extra columns in the report and your link to the form remains,
    good luck,
    DickDral

  • ORA-06528: Error executing PL/SQL profiler

    Hai
    I would like to see the outcome of package (to view the report on the package).In order to get that
    I installed the below package connect as internal
    sql>d:\oracle\orq81\rdbms\admin\profload.sql
    In order to use dbms_profiler,after that i need to have installed profilling tables ,in order to get i ran proftab.sql ,and its created three tables are
    plsql_profiler_data,plsql_profiler_units,plsql+profiler_runs
    after that i ran the below procedure
    create or replace procedure do_mod as
    cnt number := 0;
    begin
    dbms_profiler.start_profiler( 'mod' );
    for i in 1 .. 500000
    loop
    cnt := cnt + 1;
    if ( mod(cnt,1000) = 0 )
    then
    commit;
    end if;
    end loop;
    dbms_profiler.stop_profiler;
    end;/
    PL/SQL procedure successfully completed.
    exec no_mod
    PL/SQL procedure successfully completed.
    In order to see the report on packge ,i had query the table , RUN_TOTAL_TIME IS 3.5190E+11(this is seconds)
    my qusetion is
    1)
    Please explain me that is total amount time in seconds or minutes,i donnot understand what is 3.5190e+11
    SQL> select RUNID,RUN_COMMENT,RUN_TOTAL_TIME FROM PLSQL_PROFILER_RUNS;
    RUNID
    RUN_COMMENT
    RUN_TOTAL_TIME
    1
    mod
    7.0975E+11
    2
    mod
    6.9767E+11
    RUNID
    RUN_COMMENT
    RUN_TOTAL_TIME
    3
    no mod
    3.5190E+11
    2)
    I had ran the above script one of the schema ,and successfully created above procedure.When i execte,it retuns below error message
    SQL> exec do_mod;
    BEGIN do_mod; END;
    ERROR at line 1:
    ORA-06528: Error executing PL/SQL profiler
    ORA-06512: at "SYS.DBMS_PROFILER", line 123
    ORA-06512: at "SYS.DBMS_PROFILER", line 132
    ORA-06512: at "MOHAN1.DO_MOD", line 4
    ORA-06512: at line 1
    Any one any idea about that
    Regards
    mohan

    1) Run_total_time is the elapsed total time in nanoseconds.
       A nanosecond is one billionth of a second.
       It is displayed in scientific notation
       where E stands for "times ten to the power of".
       So, 3.5190E+11 nanoseconds
         = 3.5190 * 100000000000 nanoseconds
         = 351900000000 nanoseconds
         = 351900000000 billionths of a second
         = 351900000000 / 1000000000 seconds
         = 351.9 seconds
       If you want to display it in seconds, use:
         SELECT runid,
                run_comment,
                run_total_time / 1000000000 AS seconds
         FROM   plsql_profiler_runs;
    2) The only thing that looks wrong about your do_mod procedure
       is the last line:
         end;/
       The / should be on the next line.
       Other than that, I don't see any possible cause for
       the error.

  • ORA-00604: error at recursive sql level 1ORA-01882: timezone region not fou

    hello eveyone i have installed SQL developer and try to create a connexion but it shows the following error:
    " : ORA-00604: error at recursive sql level 1ORA-01882: timezone region not found"
    (i choosed TNS as connexion type , default as rol )
    plz help
    thanks

    Hi Raccio,
    Using the forum search functionality, I came across the following threads with some tips that might help you:
    ORA-00604 & ORA-01804 when connecting to Oracle 11 database 11.1.0.6.0
    ora-01882 "timezone region not found" with 3.0.03.97 but not with 3.0.03.45
    Regards,
    Gary Graham
    SQL Developer Team
    Edited by: gggraham on Jul 20, 2011 1:03 PM

  • ORA-01423: error encountered while checking for extra rows in exact fetch

    ERROR at line 1:
    ORA-01423: error encountered while checking for extra rows in exact fetch
    ORA-01722: invalid number
    ORA-06512: at "Department.get_emp_name", line 57
    ORA-06512: at line 14
    Hi
    The above are the error messages I am running into and I am not sure what it means at all. I do have a query which select few rows into cursor
    cursor c_requested is
    select * from departments where emp_id in (1, 2, 3)
    now from these rows I again creating a query dynamically
    open c_requested;
    loop
    fetch c_requested into deptID, name, authorized; -- declared variables
    exit when c_requested%NotFound;
    sqlstring := 'Select name from employees where deptID = ' || deptID || ' and Authorized = ' || authorized;
    begin
    execute immediate sqlstring into description; -- declared variable
    exit;
    exception when no_data_found then
    description := 'FILTER_OUT';
    end;
    end loop;
    close c_requested;
    This code is inside a function get_emp_name(). When I execute this function I am getting the above errors. I really appreciate all your help. Please let me know if you need more information.
    Thank you very much

    Thank you very much damorgan,
    I looked through my code and figured out what was wrong. I had a varchar2 column in the table where I was passing a value 999 instead of '999'. Thanks again.
    I have one more question. I am using cursor to loop through.. here is my code
    rowcount integer;
    cursor c_emp is
    select * from employees where empID in (....);
    begin
    open c_emp;
    rowcount := c_emp%RowCount;
    loop
    end loop;
    dbms_output.put_line(rowcount);
    end;
    I am getting rowcount = 0 even though there are many values in it. I am not sure if I am using the where clause properly. Any help would be appreciated.
    thank you.

  • Tcode for form based report

    dear sap gurus:
    can any one tell me the all t code for form based report like ke86 and other and why it is diffrent from report painter

    Dear Makrand,
    Please look into the following:
    I brought profit center in selection criterion:
    For this I have changed my Form T Code:  KE35:
    General Data Selection :
    Included Profit center along with the controlling Area.
    Then I changed my report:
    KE30:
    Variables Tab:
    Givn Profit center as entry at execution.
    Hope this will helps you......
    Regards,
    Pavan Kumar Arvapally

  • Date Validation problem in form with report

    Hi,
    I am stuck on this date validation issue in a form with report that I am working on-
    I have an Active_date_start and an Active_date_end field. I want to validate the form in such a way that if the user enters the Active_date_end < active_date_start then it should error out appropriately asking to change the active_end_date . Also another problem is that the changes are made to the active_date_end they should reflect in the table. How do I accomplish this.
    Appreciate all the help offered.
    Thanks.

    Hi,
    Thanks for the code.Now the APPLY CHANGES works fine except that it throws an error when I change the end date to a date which is less than the start date . So it does show me my error and does not go further but also shows me the error -
    Invalid PL/SQL expression condition: ORA-06550: line 1, column 29: PLS-00306: wrong number
    or types of arguments in call to 'NVL' ORA-06550: line 1, column 7: PL/SQL: Statement
    ignored Invalid PL/SQL expression condition: ORA-06550: line 1, column 29: PLS-00306:
    wrong number or types of arguments in call to 'NVL' ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    I looked up the error number and it says its a generic error type where the error can be found on the line number specified. But in this case how and where do I look for the error line?. This is the code I am using-
    DECLARE
    vACTIVE_DATE_START DATE;
    vACTIVE_DATE_END DATE;
    BEGIN
    vACTIVE_DATE_START := TO_DATE(:P4_ACTIVE_DATE_START, 'DD/MM/YYYY');
    vACTIVE_DATE_END := TO_DATE(:P4_ACTIVE_DATE_END, 'DD/MM/YYYY');
    IF vACTIVE_DATE_END < vACTIVE_DATE_START THEN
    RETURN 'End date is before start date';
    ELSE
    RETURN NULL;
    END IF;
    END;
    My base table has the active_date_start as NOT NULL. Now I have the exact same code for APPLY CHANGES
    in other form and it works fine not giving the above error. I am at a loss to know how I can get rid of the error.
    Any suggestions!.
    Thanks in advance,
    A

  • Form with report question

    Hi,
    I have developed all my forms of type 'Form with report' which after entering values, displays the report page that shows the details entered.
    In the form page definition I have a select list for customer id which diplays 'customer name' as return value. So after the form values are entered it redirects to the report page which displays the details such as customer id etc. How do I make this page to display the customer name instead of customer id. From user's perspective it would make more sense if he can see the customer name for editing/changes.
    Also I wanted to know which kind of report would be the most appropriate if the report is based on a PL/SQL block. Would it be as interactive ?.
    Appreciate all suggestions posted.

    Hi Zahid,
    Yes, That is exactly what I wanted. So now I have my other table (resources ) for getting the resource_name . I do not see any quotes in your query which makes me wonder how your query under – ‘Region source’ of the Region definition looks like. Could you paste you code exactly as seen there. Besides I am not sure if we can join tables in there. I was getting –Unable to parse query error as well as Invalid character. I am not entirely sure of the syntax of the query definition in the report page as it is automatically generated . Any ideas? . I am pasting my query here for you to look at.
    Appreciate your help.
    select "RR.RESOURCE_ROLE_ID",
    "RR.RESOURCE_ID";
    "RE.RESOURCE_NAME",
    "RR.ROLE_ID",
    "RR.PROJECT_ID",
    "RR.CREDITS_PER_HOUR",
    "RR.ACTIVE_DATE_START",
    "RR.ACTIVE_DATE_END",
    "RR.LAST_UPDATED_BY",
    "RR.LAST_UPDATE_DATE",
    "RR.CREATED_BY",
    "RR.CREATION_DATE"
    from "#OWNER#"."RESOURCE_ROLES" "RR",
    "#OWNER#"."RESOURCES" "RE"
    where "RR.RESOURCE_ID" "=" "RE.RESOURCE_ID";
    Thanks,
    A

  • Form with report, where some items in the form have been given values.

    Hi, greetings:
    I have a question that maybe silly but annoying to me. I need to provide a form with report, where some items in the form have been given values automatically, and these items (display only) are supposed to show given values in the form automatically.
    I used the APEX form with report. The update and delete worked well. But I cannot show automatic values when insert. By default APEX insert form makes every item null; I tried to give value for two items: P5212_USERKEY, P5212_DAILY_VER_DATE with process before header, after header, after regions and before footer, and computation, or set values of these two items in the branch when user hit create button (submit). It never worked out, the two items always displayed null value, and when I insert, I got "ORA-01400: cannot insert NULL into ("TBSBI"."DAILYVERPRODNOTE"."USERKEY")", since I have set up constraint in database that these two columns should not be null.
    Could anyone help on this? any suggestion would be appreciated.
    Sam

    If you have made these values 'Display Only' they would by default not save the session state. Accessing the page items will always return NULL. Did you change the 'Save Session State' option to 'Yes'?

  • Creating a Form with Report based on View

    Hi All,
    I wanted to create a form with report based on two tables so:
    1. I created a view (called COMBO) based on two tables
    2. I then created a form with report based on the view
    Everything seemed fine thus far until I tried to edit existing records - I got the error:
    ORA-20505: Error in DML: p_rowid=2002082600001172, p_alt_rowid=REPATRIATION_ID, p_rowid2=, p_alt_rowid2=. ORA-01776: cannot modify more than one base table through a join view
    Unable to process row of table COMBO.NB: REPATRIATION_ID is the primary key of the Repatriation table. The other table is Applicant.
    & when I tried to create a new record - I got the error:
    ORA-01776: cannot modify more than one base table through a join view
    Unable to process row of table COMBO.Someone please enlighten me!
    Kind Regards
    Kamo
    Edited by: Kamo on 2009/03/12 2:33 AM

    Hello Kamo,
    You need to create an 'instead of' (update/insert/delete) trigger on your view to process the inserts etc into the 'real' tables.
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Image upload in  Form with Report

    Hello
    I have created a table FA_CUST_DTL
    Column Name     Data Type     Nullable      Default     Primary Key
    CUST_ID NUMBER      No          1
    CUST_NAME     VARCHAR2(1000) Yes          
    CUST_ADD     VARCHAR2(4000)     Yes          
    MOBILE     NUMBER(12,0)     Yes          
    PHONE     VARCHAR2(15)     Yes          
    EMAIL     VARCHAR2(100)     Yes          
    SIGNATURE_IMAGE     BLOB     Yes          
    MIMETYPE     VARCHAR2(200)     Yes          
    FILENAME     VARCHAR2(400)     Yes          
    IMAGE_LAST_UPDATE     DATE      Yes          
    Then i created a page Form With report with the trigger . After Browsing , images are not showing in my report.
    Can u tell me any idea abt it plz help me its urgent for me.
    Regards
    Geet

    If you need to control height and width of your uploaded images, then you must use the APEX_UTIL.GET_BLOB_FILE_SRC function. Please refer to this documentation:
    [http://download.oracle.com/docs/cd/E10513_01/doc/apirefs.310/e12855/apex_util.htm#AEAPI129]

  • Form with report Related

    Hi,
    I have created form with report.i want to apply the function like initcap,upper or lower apply changes portion of item.
    e.g when i click on pencil image to modify the value.item which holds the value.if i enter value in lower case.i want to make value in initcap format.how can i apply this function.
    Please help me to solve this problem.
    Thanks & regards
    Nisha

    Hi,
    First of all when do you want to make them Initcap? If its after submit, then you can handle it in your DML or at trigger level. If its before submit, you can go with JS.
    for those who prefer recursion over looping...
    <script type="text/javascript">
    function fnInitCap(pStr)
        var vReturn;
        if (pStr.indexOf(" ") != -1)
            // Initcap the first word
            vReturn = pStr.substring(0, 1).toUpperCase() + pStr.substring(1, pStr.indexOf(" ") + 1).toLowerCase();
            // Contains multiple words, call function recursively
            return vReturn + fnInitCap(pStr.substring(pStr.indexOf(" ") + 1, pStr.length));
        else
            vReturn = pStr.substring(0, 1).toUpperCase() + pStr.substring(1, pStr.length).toLowerCase();
            return vReturn;
    </script>and put following in item attributes..
    onChange="javascript:this.value=fnInitCap(this.value);"Regards,
    Hari

  • Use Formule on FORM with REPORT - result stored at table

    Hi all,
    What is the best solution for?
    I have region with FORM WITH REPORT on the same PAGE.
    Values stored at table INFO with column ID, MYDATE, TIME_START_HOUR, TIME_START_MIN, TIME_END_HOUR, TIME_END_MIN, SUM1, SUM2
    ITEMS on the form:
    P1_ID (hidden)
    P1_MYDATE (date picker)
    P1_TIME_START_HOUR (select list)
    P1_TIME_START_MIN (select list)
    P1_TIME_END_HOUR (select list)
    P1_TIME_END_MIN (select list)
    P1_SUM1 (hidden)
    P1_SUM2 (hidden)
    After user fill in MYDATE, TIME_START_HOUR, TIME_START_MIN, TIME_END_HOUR, TIME_END_MIN then I need proces for calculation SUM1 en SUM2. Result stored (one record) at table INFO.
    Report shows all columns. User had possibility to update the record
    Formule:
    Select
    (CASE
    when to_char(mydate,'DY','nls_date_language=dutch') in ('ZA','ZO')
    THEN substr(to_timestamp (mydate||':'||TIME_END_HOUR||':'||TIME_END_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
    to_timestamp (mydate||':'||TIME_START_HOUR||':'||TIME_START_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
    (interval '00 00:00:00' day to second)
    ,12,5)
    ELSE '08:00'
    END) SUM1,
    (CASE
    when to_char(mydate,'DY','nls_date_language=dutch') in ('ZA','ZO')
    THEN substr(to_timestamp (mydate||':'||TIME_END_HOUR||':'||TIME_END_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
    to_timestamp (mydate||':'||TIME_START_HOUR||':'||TIME_START_MIN ||':00','DD-MM-YY:HH24:MI:SS') -
    (interval '00 04:00:00' day to second)
    ,12,5)
    ELSE '04:00'
    END) SUM2
    FROM INFO
    where id=:ID
    What is the best way for the calculation: computation or processes or etc? The calculation after or before user push button(New:create button of Update:Apply Changes)?
    How to fill the answer (SUM1 and SUM2) at table INFO?
    Thanks Walter

    I have something similar I use:
    DECLARE
      str_day      VARCHAR2(10);
      dt_indx      DATE;
      db_dt_indx   VARCHAR2(20);
      str_st_tm    VARCHAR2(20);
      dt_st_tm     DATE;
      db_st_tm     VARCHAR2(20);
      str_ed_tm    VARCHAR2(20);
      dt_ed_tm     DATE;
      db_ed_tm     VARCHAR2(20);
      shft_flag    NUMBER;
    BEGIN
      str_day    := :P1050_DATE_MM || '/' || :P1050_DATE_DD || '/' ||  :P1050_DATE_YYYY;
      dt_indx    := to_date(str_day, 'MM/DD/YYYY');
      db_dt_indx := to_char(dt_indx, 'MM/DD/YYYY');
      str_st_tm  := str_day || ' ' || :P1050_TIME_IN_HH || ':' || :P1050_TIME_IN_MI || ' ' || :P1050_TIME_IN_AM;
      dt_st_tm   := TO_DATE(str_st_tm, 'MM/DD/YYYY HH:MI AM');
      str_ed_tm  := str_day || ' ' || :P1050_TIME_OUT_HH || ':' || :P1050_TIME_OUT_MI || ' ' || :P1050_TIME_OUT_AM;
      dt_ed_tm   := TO_DATE(str_ed_tm, 'MM/DD/YYYY HH:MI AM');
      --Alter date if night shift
      SELECT NVL(:P1050_NIGHT_FLAG,0) into shft_flag from dual;
      IF dt_ed_tm < dt_st_tm THEN
        dt_ed_tm := dt_ed_tm + 1;
      END IF;
      db_st_tm   := to_char(dt_st_tm + shft_flag,'MM/DD/YYYY HH:MI AM');
      db_ed_tm   := to_char(dt_ed_tm + shft_flag,'MM/DD/YYYY HH:MI AM');
    end;You'll need to modify it for your page variables.

  • Question of Form with Report?

    This is great since I can create a form with report.
    For my search on form selection, I can only select one column, can I select more than one columns so I can search column A and B?
    Thank you.

    User,
    What is your name?
    Yes, when you're creating the report it's easy as you should see a list of columns and be able to select the ones you want. Afterward you'll have to manually modify the query which is easy enough.
    Regards,
    Dan
    http://danielmcghan.us
    http://sourceforge.net/projects/tapigen
    http://sourceforge.net/projects/plrecur
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Form with report, update field in the form = field is not updated in table

    Hi,
    I have a form with report. On Primary Key in the report is a link to the form. I select one row in the form by choosing the link in the report. Then I update a field in the form and press "Save". I see the success message "Action processed" and I'll be back in the report. I see the field in the report with it's old content. It is not updated. I don't understand why. Can anybody help me?
    Thanks Daniela

    Daniela,
    Is the form field source set to the proper database column? It's either not properly defined or your Save button and the builtin update process have somehow become disconnected. Check to make sure that the Save button is set to perform an Update in the database operations setting.
    Earl

Maybe you are looking for

  • New Mac Pro or 27" iMac

    I apologize in advance for the length but I need some help in making a decision. SITUATION: I run a small business and currently have a Late 2012 21.5" iMac and two 23" monitors (3 screens total for running multiple applications and copy/pasting). My

  • MeRepMeta.xml doesn't work for MAM 2.5

    I have a problem with my meRepMeta.xml. Background: Before we used WAS 6.20 and MAM 2.0. Exporting the XML file for our upload SYncBO and added to the original meRepMeta.xml worked well. At least the following code worked were Z_EPC is the name of ou

  • Best Way to Connect my REAL electric guitar to my computer? Please Help

    Anyone know how to Connect my REAL electric guitar to my computer? Please Help, thanks!

  • Process chain sequence change

    Dear all, I want to cahnge the sequence of the processes in my main process change i want to shift one activity above the other if i make changes and transport those changes to production then will it generate error in previous logs. Is it right to d

  • Syncing Without Going to the Cloud?

    Is it possible to continue syncing contacts and calendar events between Outlook and the iPhone 4 using iTunes after iTunes version 10.1.2.17 without going to the "Cloud"? Has anyone accomplished this? I would like to be able to continue using my iPho