HTML in PL/SQL block

How to add "Welcome" using HTML in the following PL/SQL block. I want to add the Welcome user message when user login in to the Apex application.
BEGIN
  HTP.prn(get_app_user);
END;Sanjay

Got the solution. Modified the PL/SQL block as follows :
BEGIN
htp.print('<p>Welcome');
HTP.prn(get_app_user);
htp.print(' to My application.<p>');
END;
Sanjay
Edited by: user12957777 on 8 Nov, 2010 10:35 PM

Similar Messages

  • HTML not working in PL/SQL block..Help me ASAP

    declare
    l_col VARCHAR2(30) :=to_number(to_char(to_date('01-feb-2011','dd-mon-yyyy'),'dd'));
    CURSOR name_cur IS
      select name
          from   od_shift_schedule
          where   year=2011
          and    (month)=('Feb')
           and    decode(l_col,1,"01",2,"02",3,"03",4,"04",5,"05",6,"06",7,
                         "07",8,"08",9,"09",10,"10",11,"11",12,"12",13,"13",14,"14",15,"15",16,"16",17,"17",18,"18",19,"19",20,"20",
                         21,"21",22,"22",23,"23",24,"24",25,"25",26,"26",
                       27,"27",28,"28",29,"29",30,"30",31,"31")='W';
    BEGIN
      DELETE FROM nam;
      commit;
      FOR i IN name_cur
      LOOP
      dbms_output.put_line(i.name);
      htp.p('<b>Employee '||i.name||'  has been ticked.
       </b><br/>');
      EXECUTE IMMEDIATE 'insert into nam(name) values('''||i.name||''')';
      commit;
    END LOOP;
    end;Kindly help me with this
    If i'm wrong here kindly help me that how can i place a display message

    Re: HTML not working in PL/SQL block..Help me ASAP
    Using the community discussion forums for urgent issues is rude and a violation of the terms and conditions.
    http://www.oracle.com/html/terms.html
    >
    4. Use of Community Services
    Community Services are provided as a convenience to users and Oracle is not obligated to provide any technical support for, or participate in, Community Services. While Community Services may include information regarding Oracle products and services, including information from Oracle employees, they are not an official customer support channel for Oracle.
    You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle
    >
    Also please read the FAQ on how to ask questions.
    SQL and PL/SQL FAQ
    >
    2) Thread Subject line
    Give your thread a meaningful subject, not just "help please", "Query help" or "SQL". This is the SQL and PL/SQL forum. We know your question is going to be about those things, make it meaningful to the type of question so that people with the right sort of knowledge can pick it up and those without can ignore it. Never, EVER, mark your subject as "URGENT" or "ASAP"; this forum is manned by volunteers giving their own time to help and your question is never urgent or more important than their own work or than other people's questions. It may be urgent to you, but that's not forum members issue.

  • How to print/store in file the ref cursor in pl/sql block ?

    How to print/store in file the ref cursor in pl/sql block ?.

    How to print/store in file the ref cursor in pl/sql block ?.You question is quite confusing?
    So, i'm providing link in this manner.
    For RefCursor,
    http://www.oracle-base.com/articles/misc/UsingRefCursorsToReturnRecordsets.php
    http://www.oracle.com/technology/oramag/code/tips2003/042003.html
    For UTL_FILE,
    http://www.morganslibrary.org/reference/utl_file.html
    Regards.
    Satyaki De.
    Updated with new morgan library link.
    Edited by: Satyaki_De on Feb 24, 2010 9:03 PM

  • Resolved: Use value from select list in pl/sql block

    Hello,
    I have a form with a select list: P18_BONUSTYPE, the values of which come from a LOV.
    When the user clicks a button, a page process is used to insert a row into a table.
    When I use the :P18_BONUSTYPE bind variable in my insert statement I get an error "Invalid number" I get an "Invalid number" error. I assume that APEX is using the displayed text in that bind variable, not its actual (html option) value.
    I checked the HTML of the page, and the correct values are in the select list.
    Can someone tell me how to get the value into a bind variable that can be used in a pl/sql block for a page process?
    Thanks
    Message was edited by:
    Neeko
    Issue was a value in another item.

    Did you tried changing the value using "to_number"? (i.e. to_number(:P18_BONUSTYPE)).
    Max.

  • Export data into Excel from PL/SQL Block

    Hi,
    Please tell me how to export data into excel comming out from PL/SQL code in APEX.
    We can simply export data into excel if we have Report region, but my query is dynamic for which i had to use PL/SQL block. Now i want to export that data into excel.
    Thanks & Regards,
    Smith

    Hi,
    Take a look here http://spendolini.blogspot.com/2006/04/custom-export-to-csv.html
    Regards
    Paul

  • Using item values in a pl/sql block or sql query in a process

    Hi,
    I am new to apex. Developing my first application.
    I have created a form with 2 items. Based on the values in these items, when I click a button, want to execute a
    query.
    eg: emp_name(item1), deptno(item2). When I clock on find button, I want to fetch the record and disply the resultant
    columns in other created items like sal,comm etc.
    How can I do this?
    I tried the following pl/sql block in a process
    begin
    select sal,comm into p1_sal,p1_comm from emp where name=p1_name and deptno=deptno;
    end;
    But it is not accepting the page items in the block.
    How to achieve this?
    Thanks,
    Kavitha

    We have many OBEs, tutorials, etc. Please visit the <a hef="http://www.oracle.com/technetwork/developer-tools/apex/learnmore/index.html" target="_window">Learn More</a> tab of our otn site.
    This is the section of the User's Guide that discusses session state -
    -- Sharon

  • ODP 10.2.0.100 + anonymous PL/SQL block

    hi,
    my ODP dont wants anonymous PL/SQL blocks...
    my code:
    OracleConnection conn = new OracleConnection(sConnectionString);
    string text =
    "declare
    d int;
    begin
    SELECT nr INTO d FROM TMPTEXTS;
    end;
    OracleCommand cmd = new OracleCommand(text, conn);
    cmd.CommandType = CommandType.Text;
    conn.Open();
    cmd.ExecuteNonQuery();
    conn.Close();
    // error message
    Oracle.DataAccess.Client.OracleException ORA-06550: Zeile 1, Spalte 1:
    PLS-00103: encountered the symbol "" expecting
    begin case declare exit for function ...
    any ideas ?
    lg dan

    The sample code at
    http://www.oracle.com/technology/oramag/oracle/06-jan/o16odpnet.html
    demonstrates using an anon block with a bind.

  • Item data using PL/SQL block region

    hello community,
    I have searched the whole forum using Pl/SQL but couldn't find an answer for this.
    I have a PL/SQL Anonymous block region, containing database items fetched by a process and custom items getting set by the Pl/SQL source.
    based on the ID I am getting the records i.e.
    Region Source (PL/SQL Anonymous block)
    declare
    CURSOR cpc_cur is SELECT "PRODUCT", "APPCODE", "COMCODE", "DESCRIPTION" from cp2 where "ID" = :P4_ID;
    begin
    for cpc_rec in cpc_cur
    loop
    :P4_P_NAME := cpc_rec.product;
    end loop;
    end;
    The custom item is text field with source Item.
    The item value is not filled in for the first time after login, but it shows the value in the session state as with status 'I', but from then onwards it works fine.
    Why is the value not fetched the first time?
    even I tried the postcalculation using nvl and it sets it to null.
    Also set_session state doesn't work.
    If I make the custom Item as Pl/SQL function, and write the query then it works fine, but gives problem as while inserting a new record the query has no ID to refer.
    Thanks in advance.
    Piyush

    Thanks Scott!!
    1) I am using PL/SQL region to get the data for few items on the form region which is based on a table, all table attributes are database items and additional Items whose data I am fetching from the PL/SQL are Custom items.
    2) Yes the loop executes only once per page view, Is their a better query?
    3) Well its very dumb to have a item source as item pointing to itself, but since the values are in session with status 'I' I thought this could do the trick!
    4) As the item source type used is [only..], the first time user logs in it doesn't displays the value, need to refresh the page, but the second time its gets the values form the session.
    5) If I make the Item source as PL/SQL function, I just fetch the records individually, same as in the query which works fine, but the items are also used for insertion (add new) and I clear the cache, so it gives error as it cannot execute the pl/sql function(no ID while addition)
    I hope I have answered your questions! If you have patience you can read the detail description.
    test application on oracle server
    http://apex.oracle.com/pls/otn/f?p=24296:1:3544773135949858:::::
    login/password test/test
    Application name :Test
    The page has 2 regions. when clicking on SN the values are transfered to form, except for 'Appcode'.
    Detail Description:
    I have a page with 2 regions.
    One region is a report region showing fewer details from a view. The other region is a PL/SQL(form region), which shows all the details and is linked to the report region.
    While linking I pass the ID from report and autofetch the data in form region.
    But some Items are not related to that database, so I created few items on form region (Custom Items). To fill in these values I did these things.
    1) Pass them through script (but passing 7 parameters through script is not good)
    2) Made another autofetch process to fetch the remaining Items, but it seems that its not possible to have 2 autofetch process on one form region.
    3) Changed the form type from HTML to PL/SQL, to assign the custom items values through code.
    for cpc_rec in cpc_cur
    loop
    :P_custom_item := cpc_rec.data;
    end loop;
    Either make source type static or Item (the same item P_custom_item).
    This pl/sql code do assign them the values, In the session state their status is 'I', but are not displayed on the page for the first login, need to refresh the page, as the source used is (only when..) it gets the value the second time.
    4) Made the item source as PL/SQL function and assign them the value. It works fine, but the same item is also used displaying description while insertion(gives error while insertion), so made a conditional process, even that gives the same error.
    I have a questions.
    If an Item status is 'I' in the session state, why is it not displaying the value on page.
    Thanking you in anticipation
    Piyush
    Message was edited by:
    user523112

  • Debugging PL/SQL blocks in SQL Developer

    Is there any way to debug blocks of PL/SQL in SQL Developer by setting breakpoints in the code? I'm using SQL Developer.
    I'm trying to debug some fairly complex PL/SQL blocks - they are not procedures or functions and so I'm unable to run them in debug mode.
    p.s. Apologies should have posted this in the database forum really.
    Edited by: Antilles on Sep 10, 2008 1:12 AM

    Hello,
    Sure you can, take a look at the following two links -
    http://sueharper.blogspot.com/2006/07/remote-debugging-with-sql-developer_13.html
    http://www.oracle.com/technology/oramag/oracle/08-may/o38browser.html
    Hope this helps,
    John.
    http://jes.blogs.shellprompt.net
    http://www.apex-evangelists.com

  • DDL inside PL/SQL Block

    Is there anyone knows if DDL statement can be include inside the PL/SQL block?
    I mean, creating a table, doing DML in that table and then dropping it? I have to do this because I'm having integrity constraint errors (ORA-02291) in the tables I will use.
    I need to
    update table_1 set id = 2 where id = 1
    but it it found child records in table_2.
    when i tried:
    update table_2 set id = 2 where id = 1
    Of course I cannot as well update table_2 because it will not found parent record in table_1, as it had an error earlier and there were more records in table_1 than table_2.
    table_1 records = 374 rows
    table_2 records = 38 rows
    I did some strange logic below:
    a. Creating a temporary table,
    b. inserting there records in table_1,
    c. updating the temp table,
    d. delete the records i got in table_1,
    e. update table_2 (can now do an update since no child records in table_1 will be found after the delete),
    f. insert records from temp table to table_1
    g. drop the temp table.
    BUT, I cannot create, manipulate, and drop that temp table inside the PL/SQL table.
    Any thoughts.
    Thanks in advance!

    Another scenario is to create your constraints as deferred. I'v recently blogged about another deferred constraint usage here
    http://gplivna.blogspot.com/2007/05/deferred-constraint-real-life-scenario.html
    but your case also is appropriate.
    But the ultimate problem BTW is that you need to update your PK values and that's at least very questionable (ok to my mind bad) design.
    Gints Plivna
    http://www.gplivna.eu

  • Display an Alert message in PL/SQL block in APEX

    Hi,
    we are getting an oracle exception while inserting a new row. As it is having the unique constaint on a coulumn.
    Now the problem iis we need to Display an "Alert message" based on the input field validation. That java script code for alert has to be embeded nside a PL/SQL block in Oracle APEX Application.
    we tried doing this with below code:
    Begin
    INSERT INTO <<table name>>(ID,NAME) VALUES (s1,:TXT_s2);
    exception when others then
    htp.p('<script language="javascript">');
    htp.p('alert("Exception");');
    htp.p('</script>');
    end;
    If anybody knows .... please reply.
    Thanks,
    Subarna
    Edited by: user9955252 on Apr 21, 2010 1:47 AM

    Hello,
    APEX Forum is here : Oracle Application Express (APEX)
    Regards

  • Display an Alert message from PL/SQL block in APEX

    Hi,
    we are getting an oracle exception while inserting a new row. As it is having the unique constaint on a coulumn.
    Now the problem iis we need to Display an "Alert message" based on the input field validation. That java script code for alert has to be embeded nside a PL/SQL block in Oracle APEX Application.
    we tried doing this with below code:
    Begin
    INSERT INTO <<table name>>(ID,NAME) VALUES (s1,:TXT_s2);
    exception when others then
    htp.p('<script language="javascript">');
    htp.p('alert("Exception");');
    htp.p('</script>');
    end;
    If anybody knows .... please reply.
    Thanks,
    Subarna

    If your end goal is showing a pretty error message instead of the message that the tables unique constraint raises try the following. This logic will show a nice message and not try to insert non-unique data.
    (1) Create a validation of type "Function Returning Error Text".
    (2) Place similar code like the following in your validation. Notice that if the unique name does not exist the no_data_found returns null allowing the validation to pass.
    DECLARE
      v_error varchar2(100);
    BEGIN
      SELECT 'A person by this name already exists.'
      INTO v_error
      FROM your_table
      WHERE your_name = :P1_YOUR_NAME;
      RETURN v_error;
    EXCEPTION
      WHEN no_data_found THEN
        RETURN NULL;
    END;

  • Performance: Operations in Cursor vs. Operations in PL/SQL block

    Why does I have a better performance when I program operations in complex cursors instead of programming the same statement in a pl/sql block in a stored procedure?
    Operation in a Cursor:
    CURSOR c IS
      DECODE(name,'Peter','dog','cat') animal
      ...The same Operation in a PL/SQL block:
    begin
      if name = 'Peter'
      then
          animal = 'dog';
      else
          animal = 'cat';
      end if;
    end;
    ...I know that a parsed cursor is placed in the Shared Pool and reference
    a context area in the PGA.
    Does anybody have an idea?
    Message was edited by:
    mad

    Maybe because if you can write only a SQL query, it is faster than to write PL/SQL code that will do the same job. See following thread for a analog discussion: Re: pl/sql table

  • How to test for différent Select into a single PL/SQL block ?

    Hi,
    I am relatively new to PL/SQL and I am trying to do multiple selects int a single PL/SQL block. I am confronted to the fact that if a single select returns no data, I have to go to the WHEN DATA_NOT_FOUND exception.
    Or, I would like to test for different selects.
    In an authentification script, I am searching in a table for a USER ID (USERID) and an application ID, to check if a user is registered under this USERID for this APPLICATION.
    There are different possibilities : 4 possibilities :
    - USERID Existing or not Existing and
    - Aplication ID found or not found for this particular USERID.
    I would like to test for thes 4 possibilities to get the status of this partiular user regardin this application.
    The problem is that if one select returns no row, I go to the exception data not found.
    In the example below you see that if no row returned, go to the exception
    DECLARE
    P_USERID VARCHAR2(400) DEFAULT NULL;
    P_APPLICATION_ID NUMBER DEFAULT NULL;
    P_REGISTERED VARCHAR2(400) DEFAULT NULL;
    BEGIN
    SELECT DISTINCT(USERID) INTO P_USERID FROM ACL_EMPLOYEES
    WHERE  USERID = :P39_USERID AND APPLICATION_ID = :APP_ID ;
    :P39_TYPE_UTILISATEUR := 'USER_REGISTERED';
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    :P39_TYPE_UTILISATEUR := 'USER_NOT_FOUND';
    END;I would like to do first this statement :
    SELECT DISTINCT(USERID) INTO P_USERID FROM ACL_EMPLOYEES
    WHERE  USERID = :P39_USERID Then to do this one if the user is found :
    SELECT DISTINCT(USERID) INTO P_USERID FROM ACL_EMPLOYEES
    WHERE  USERID = :P39_USERID AND APPLICATION_ID = :APP_ID ;etc...
    I basically don't want to go to the not found exception before having tested the 4 possibilities.
    Do you have a suggestion ?
    Thank you for your kind help !
    Christian

    Surely there are only 3 conditions to check?
    1. The user exists and has that app
    2. The user exists and doesn't have that app
    3. The user doesn't exist
    You could do this in one sql statement like:
    with mimic_data_table as (select 1 userid, 1 appid from dual union all
                              select 1 userid, 2 appid from dual union all
                              select 2 userid, 1 appid from dual),
    -- end of mimicking your table
             params_table as (select :p_userid userid, :p_appid appid from dual)
    select pt.userid,
           pt.appid,
           decode(min(case when dt.userid = pt.userid and dt.appid = pt.appid then 1
                           when dt.userid = pt.userid then 2
                           else 3
                      end), 1, 'User and app exist',
                            2, 'User exists but not for this app',
                            3, 'User doesn''t exist') user_app_check
    from   mimic_data_table dt,
           params_table pt
    where  pt.userid = dt.userid (+)
    group by pt.userid, pt.appid;
    :p_userid = 1
    :p_appid = 2
        USERID      APPID USER_APP_CHECK                 
             1          2 User and app exist   
    :p_userid = 1
    :p_appid = 3
        USERID      APPID USER_APP_CHECK                 
             1          3 User exists but not for this app
    :p_userid = 3
    :p_appid = 2
        USERID      APPID USER_APP_CHECK                 
             3          2 User doesn't exist  

  • How to use the WHENEVER SQLERROR EXIT statement in a PL/SQL block.

    Hi,
    I am getting the following error when trying to add the following statement in an PL/SQL block.
    WHENEVER SQLERROR EXIT SQL.SQLCODE
    [exec] ERROR at line 23:
    [exec] ORA-06550: line 23, column 12:
    [exec] PLS-00103: Encountered the symbol "SQLERROR" when expecting one of the
    [exec] following:
    [exec] := . ( @ % ;
    How can i use the above statement in the PL/SQL Block? I have only IF statement in that block( between BEGIN and END).
    Thanks

    Hi,
    Usually there's always more than one solution.
    Can you post an example of what you're trying to accomplish?
    That would be useful.
    (Place the tag before and after your example to maintain formatting en spacing, see the [fac|http://forums.oracle.com/forums/help.jspa] regarding available tags)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Scripting from H4 to H3 or Header

    If I have a bunch of documents made in Acrobat X, I need to write a script that will change the H4 tags to an H3 or Header tag so that the nesting warning will go away.  The document reads perfectly. The way that I am doing this manually, it with the

  • Problem w/ Nested Datasets and Master/Detail regions

    Hi, I'm being using spry for a couple of applications and really love it. This is the first time I've tried to utilize a nested dataset and I'm having some difficulty loading the nested data. I'm getting a js 'Object does not support this property or

  • How to set "global" font?

    Where must I change font type and / or style to take effect in whole applet? I do not want to do that for every item separately. If I set font for applet it does not effect in panels and other elements. I am using Netbeans 5.5, Java 1.5.

  • Re: Satellite Pro A300-1EA - Difficulties in BIOS update

    Hi there, I attempted to update BIOS on my new Satellite Pro A300-1EA (PSAG9E-001001EN) as prompted by Tempro, from version 1.50 to 1.90. The system froze completely during BIOS flash, after waiting for 1 hr, I decided to turn off the power and pray

  • ALV using OOPS class CL_GUI_ALV_GRID, call method SET_TABLE_FOR_FIRST_DISPL

    I NEVER USED OOPS CONCEPT.BUT I GOT A TASK ON ALV REPORT USING class CL_GUI_ALV_GRID, call method SET_TABLE_FOR_FIRST_DISPLAY for ALV . I HAD PASSED THE VALUES FROM INTERNAL TABLE AND GOT OUTPUT IN ALV. The problem is When i save an layout(default se