PL/SQL : HTP  Rowtype

Hi
i wish to pass a rowtype as an input parameter to a procedure that shall display data from the rowtype . Simple data types are accepted by the procedure and displayed , but i am not sure how to do the same with a rowtype .
Thanks.

Not really possible as a pure generic procedure. If it receives a row as a dynamic structure, then the code needs to be able to determine what the actual structure is at run-time.
This is not really possible at rowtype level. It can be done at cursor level. A DBMS_SQL has a describe interface that allows you at run-time to create a cursor (any SELECT statement) and then ask the cursor to provide you with a list of column names and data types returned by the query.
Once you know the projection of the cursor, you can easily render it - like APEX does using DBMS_SQL cursors and the HTP API to create HTML code for the browser to render.

Similar Messages

  • Passing parameters to PL/SQL table types

    Hi Everybody,
    I have one question about passing PL/SQL tables types and tabs as IN parameter in procedure.I am working in 11.2.0.2.0 environment. I am stuck on how to pass those values to procedure.Please find below more details:
    Table 1:
    CREATE TABLE ITEMS
    ITEM_ID VARCHAR2(40 BYTE) NOT NULL,
    ITEM_NAME VARCHAR2(40 BYTE),
    SERIAL NUMBER(2),
    ADDED_ON DATE);
    Table 2:
    CREATE TABLE ITEM_ACTIVITY_INFO
    ITEM_ID VARCHAR2(40 BYTE) NOT NULL,
    ACCOUNT_TYPE VARCHAR2(1 BYTE),
    ID_NUMBER NUMBER(3),
    ACTIVATION_DATE DATE);
    Table 3:
    CREATE TABLE ITEM_GROUP
    GROUP_ID NUMBER(2) NOT NULL,
    ITEM_ID VARCHAR2(40 BYTE),
    GROUP_TYPE VARCHAR2(20 BYTE),
    GROUP_DATE DATE);
    Table 4:
    CREATE TABLE ITEM_ADDRESS
    GROUP_ID NUMBER(2) NOT NULL,
    NAME VARCHAR2(60 BYTE),
    ADDRESS VARCHAR2(100));
    Following types are created:
    CREATE OR REPLACE TYPE ITEMS_TYPE AS OBJECT
    ITEM_ID VARCHAR2(40 BYTE),
    ITEM_NAME VARCHAR2(40 BYTE),
    SERIAL NUMBER(2),
    ADDED_ON DATE);
    CREATE OR REPLACE TYPE ITEM_ACTIVITY_TYPE AS OBJECT
    ITEM_ID VARCHAR2(40 BYTE),
    ACCOUNT_TYPE VARCHAR2(1 BYTE),
    ID_NUMBER NUMBER(3),
    ACTIVATION_DATE DATE);
    CREATE OR REPLACE TYPE ITEM_GROUP_COMP_TYPE AS OBJECT
    GROUP_ID NUMBER(2) NOT NULL,
    ITEM_ID VARCHAR2(40 BYTE),
    GROUP_TYPE VARCHAR2(20 BYTE),
    GROUP_DATE DATE
    ITEM_ADDRESS_IN ITEM_ADDRESS_TYPE);
    CREATE OR REPLACE TYPE ITEM_ADDRESS_TYPE AS OBJECT
    GROUP_ID NUMBER(2),
    NAME VARCHAR2(60 BYTE),
    ADDRESS VARCHAR2(100));
    CREATE OR REPLACE TYPE ITEM_GROUP_COMP_TAB AS TABLE OF ITEM_GROUP_COMP_TYPE;
    Create or replace procedure ITEM_ADD_CHANGE(
    ITEM_IN IN ITEMS_TYPE,
    ITEM_ACTIVITY_IN IN ITEM_ACTIVITY_TYPE,
    ITEM_GROUP_IN IN ITEM_GROUP_COMP_TAB,
    ITEM_OUT IN OUT ITEMS.ITEM_ID%TYPE);
    Above are the paramteres we are passing to procedure.
    I need help in how to pass parameters to above procedure. All comments and responses will be highly appreciated. Thanks everyone for going through the post. Please let me know if more more information is required on this problem.
    Regards
    Dev

    Billy  Verreynne  wrote:
    Types used in this fashion, only make sense if the table is based on the type. It makes very little sense to have a table structure and then to duplicate the structure using a type.
    The 2 structures may be defined the same. But they are NOT interchangeable and requires one to be converted to the other to use. This is not sensible in my view. It is far easier in that case to simply use the PL/SQL macro +%RowType+ to create a duplicate structure definition - one that can natively be used for touching that table, without conversions required.
    If you do want to use types, define the type, then define the table of that type, adding the required constraints (pk, fk, not null, check) to the table's definition.Billy:
    Just curious, why do you say it makes very little sense to have a type modeled on a table? I do that a lot. In my case, I am getting the values from an external program, not building them manually, but it makes a lot of sense to me.
    One application where I do this a lot has a java front-end that parses HL7 messages. Each message contains at least minimal information about a variable number of entities (and often several rows for an entity) in the database, and must be processed as a single atomic trasnaction. So, rather than have potentially hundreds of parameters to the "main" driver procedures for different message types I created a set of types more or less identical to the tables representing the entities. The java program parses the mesasge and populates the type, then calls the appropriate stored procedure for the message type passing in the populated types. My stored procedure then does inserts/updates or deletes as appropriate over potentially dozens of tables.
    John

  • Special character and htp.p()

    I am trying to use PL/SQL procedure to present my customized item.
    If user type in secial character, e.g. single quote ', in the attribute, I got this error on the page:
    Error 30584: DBMS_SQL has raised an unhandled exception. ORA-06550: line 1, column 327: PLS-00103: Encountered the symbol "03" when expecting one of the following: . ( ) , * @ % & = - + < / > at in is mod not rem <> or != or ~= >= <= <> and or like between ||
    Is there a procedure I can call to encode the special character?
    thanks

    Hi - thanks very much the reply. I will bear your suggestions in mind in future as they are very useful.
    I got around the problem I was having by doing the following:
    The line of JavaScript I wanted to output to the page was:
    document.write('&lt;img src=" '+ns_l+' " width="1" height="1" alt="*" /&gt;');}
    And I achieved this by using the following PL/SQL:
    htp.p('document.write('||'''&lt;img src="'''||'+ns_l+'||'''" width="1" height="1" alt="*" /&gt;'''||');}');

  • Help on HTP.P in PL/

    I am using the following line of code in my PL/SQL procedure.
    htp.p('Link');
    Actually the application is deplyed and running in Weblogic server. If I running the application normally it is displaying content of JSP file which contains Forward,BackWard,Refresh buttons.i.e displaying all webcontent data. But when I tried access this page from the above link using PL/SQL HTP code, I can see one tab content only. I cann't see the all tabs names and forward,backward,refresh buttons at all. Can you please suggest me how can I load the webcontent into HTP code html page?
    Thanks in advance...

    Duplicate posting.
    {message:id=4198256}

  • PL/SQL Javascript Function Call

    Can anyone offer some help on this? I am attempting to get a javascript tool tip to work on an application I am developing. I have developed a line calendar using PL/SQL outputting HTML. When I embed a javascript function into my PL/SQL htp.p function, the javascript appears to go a little crazy. Here is an example of my code:
    "htp.p('<td onMouseover="ddrivetip("Yahoos Site", "yellow", 250)"
    onMouseout="hideddrivetip()">Yahoo</td>')
    I have tried a few iterations, using different javascript, and I always get the same result. The double quotes used in the onMouseover and onMouseout function calls are a result of PL/SQL not liking single quotes. The entire code for the tooltip can be found on dynamic drives page:
    http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip.htm
    The CSS and javascript code is placed as appropriate in the HTML page header. Am I missing something on the htp.p command?
    Message was edited by:
    jason97m
    Message was edited by:
    jason97m

    This post covers it well.
    http://inside-apex.blogspot.com/2007/08/using-tooltips-in-oracle-apex.html
    Good luck.
    Brian

  • Search dbxml, owains, htp packages

    I am searching to download these package :
    owains.sql, htp*.sql
    because i try to use The dbxml package who need the previous package. We work under
    Oracle 8.0.4 release.
    Thanks, DP

    They are included in the .\xsql\demo\owa\owa_package.zip that come with the XSQL Servlet.

  • Record vs object vs globle table in pipelined function

    i want to make pipeline function , i show it can be made in following ways
    please suggest which one is better in performance and maintenance.
    1)
    create type my_tab_type is object
    (prodid number, a varchar2(1), b varchar2(1),
    c varchar2(1), d varchar2(1), e varchar2(1))
    create type my_tab_type_coll is table of my_tab_type;
    create or replace function get_some_data (p_val in number)
    return my_tab_type_coll pipelined is
    begin
    FOR i in (select * from my_table where prodid=p_val) loop
    pipe row(my_tab_type(i.prodid,i.a,i.b,i.c,i.d,i.e));
    end loop;
    return;
    end;
    SELECT * FROM table(get_Some_Data(3));
    2)
    one can create globle tem table "Tlb_3". then can make a package like fllowing
    create or replace
    PACKAGE pk1
    AS
    TYPE T_type IS TABLE OF Tlb_3%ROWTYPE;
    END;
    and rest of the thing will be same like first one.
    3)
    TYPE outrec_typ IS RECORD (
    var_num NUMBER(6),
    var_char1 VARCHAR2(30),
    var_char2 VARCHAR2(30)
    TYPE outrecset IS TABLE OF outrec_typ;
    and rest of the thing will be same like first one
    so main question is relating to declaretion of TABLE which is returned.
    yours sincerely
    Edited by: 944768 on Jan 2, 2013 4:23 AM

    DUPLICATE THREAD!
    How many times do you intend to ask this question?
    This is the same question that you ask, and got answered, six months ago in this thread?
    how to write Function returing table or set of rows.
    And you ask it again a week ago in this thread
    object vs record in pipelined function.
    Have you forgotten those answers already? Why didn't you take the advice given there and perform some tests?
    And you don't seem to acknowledge any of the help you get to your questions by marking them ANSWERED when they have been.
    Please revisit this 32 questions and mark them ANSWERED as appropriate - Total Questions: 73 (32 unresolved)
    >
    i want to make pipeline function , i show it can be made in following ways
    please suggest which one is better in performance and maintenance.
    >
    Why didn't you take the advice given there and perform some tests?
    Option #1, using SQL types is better, especially for maintenance. Also SQL types are required if the function is going to be called from SQL. You can define PL/SQL or %ROWTYPE package variables and use them but Oracle will silently create 'hidden' (in 11g) SQL types and use those.
    See Solomon's explanation and sample code in this recent thread
    Re: Pipe line function
    There certainly isn't any need to create a global temp table just so you can create the %ROWTYPE variable; you can create one of those based on a CURSOR.

  • FORM based on a SP

    Build a FORM based on a database stored procedure (SP) in Portal is very easy.
    Is this easy too to modify the FORM if I modify the amount of parameter or data type of SP ?
    TIA,
    ferry

    When you click on your "find" button, certain javascript functions are called on the OnClick action that set the values of
    some hidden variables used by forms. Pressing Enter submits the form without calling the javascript functions and hence
    without setting the values for the hidden variables.
    You can write your own javascript to capture the pressing of the Enter key and then call the javascript functions yourself
    and then submit the form.
    You can write these javascript code using pl/sql htp.p('<script>....); in the "...before form display" additional pl/sql section.

  • Execute Stored Procedure in NAV region

    Hi
    I have a Stored procedure that display a form (I am using PL/SQL, HTP). It create a table.
    I want include call the stored procedure, in the Navigation BAR and display de table in the NAV Region.
    Can I do?
    tks

    Hi Gordon,
    I look at this thread but it's not help me.
    I would like to get SAP window that i can take parameters with %0, %1 ...
    I try this :
    DECLARE @return_value int
    DECLARE @code_Com int
    DECLARE @prj_begin varchar(15)
    DECLARE @prj_end varchar(15)
    SELECT @code_Com = MAX(T0.[SlpCode] FROM OSLP T0 WHERE T0.[SlpCode]=[%0]
    SELECT @prj_begin = MAX(T1.[PrjCode] FROM OPRJ T1 WHERE T1.[PrjCode]='[%1]'
    SELECT @prj_end = MAX(T2.[PrjCode] FROM OPRJ T2 WHERE T2.[PrjCode]='[%2]'
    EXEC @return_value = dbo.commissionProjetClos
    @Commercial= @code_Com, @prjBegin=@prj_begin, @prjEnd=@prj_end
    but it's not working.
    I try this other test :
    DECLARE @return_value int
    DECLARE @code_Com int
    DECLARE @prj_begin varchar(15)
    DECLARE @prj_end varchar(15)
    DECLARE @cmd nvarchar(max)
    DECLARE @cmd1 nvarchar(max)
    DECLARE @cmd2 nvarchar(max)
    SET @cmd=('SELECT MAX(T0.[SlpCode] FROM OSLP T0 WHERE T0.[SlpCode]='+[%0])
    SET @cmd1 = ('SELECT @prj_begin = MAX(T1.[PrjCode] FROM OPRJ T1 WHERE T1.[PrjCode]='''''[%1]'''')
    SET @cmd2 = ('SELECT @prj_end = MAX(T2.[PrjCode] FROM OPRJ T2 WHERE T2.[PrjCode]=''''[%2]'''')
    EXEC(@cmd)
    EXEC(@cmd1)
    EXEC(@cmd2)
    EXEC @return_value = dbo.commissionProjetClos
    @Commercial= @code_Com, @prjBegin=@prj_begin, @prjEnd=@prj_end
    It's not working too.
    So how can i do this ? It is possible ?
    Thanks,
    Regard,
    Michael

  • Running OAS plsql toolkit in HTML DB

    Hi, we currently have a lot of code written using the OAS plsql toolkit, running on an Oracle 8.1.6 database. These are primarily pages that are hosted on the internet.
    I was wondering could be migrate this plsql code to Oracle 10G, dispense with the now outdated OAS altogether and use the new features of HTML DB to run the plsql pages, without really any alteration.
    Does Oracle 10G allow us to put these pages onto the web using the Apache listener.
    Has anyone else done this?

    You can't "run" the PL/SQL pages with HTML DB. What you will find is that you can throw away 90% of your code used for UI and keep the queries used for reports and any SQL or PL/SQL used for DML.
    HTML DB will handle all of the UI, session state, report sorting and pagination, and form fields. I strongly encourage you (if you have not already) to write a few reports and play with the built-in column-heading sorting, pagination, and templates before you start this process. The reason I say this is that time after time, I see people faced with your exact task trying to hold on to their pl/sql htp.p's for reports. It takes them a while to see the light, and when they do, they wonder why they've been fighting it.
    asktom.oracle.com and think.com both went through this. It's amazing how much more you can focus on the content of the app and adding new functionality when you don't have to worry about the stuff HTML DB takes care of for you. Just try it out on htmldb.oracle.com, you'll get what I'm saying in no time.
    Good luck,
    Tyler

  • Grouping report

    Can I create a report where data is grouped on the basis of some columns in the query
    For example :My report should show like
    Assigned ID Date Description
    To
    ====== === ===== ============
    ALAN01 12345 23-JUN-07 This is the desription
    Entry Date :23-JUN-07 Entry Text:Pass to ABC dept
    Entry Date :24-JUN-07 Entry Text:Pass to DEF dept
    ALAN02 12346 12-JUN-07 This is the desription
    Entry Date :12-JUN-07 Entry Text:Pass to ABC dept
    Clearly there are two sections in the report for each row
    The first one is the person , id, date and description
    For this data there may be multiple entry date and entry text
    In normal view , the person , id, date and description repeat
    for every entry date and entry text.
    Is there any way I can group them ?

    Rakhee,
    This is essentially a Master-Detail report. You can do this with Advanced PDF Printing (see the new how to http://www.oracle.com/technology/products/database/application_express/howtos/howto_master_detail_pdf.html).
    To do this in a region displayed on a page your can:
    1) Create two reports, one that displays the master and a second that displays the details and then your users will need to scroll through each master.
    2) If you want one report that runs down the page with all the data, you can either do some creative sql using a union or you can use pl/sql, htp.p and a loop to grab each parent, print it and then grab the children for that parent and print those.
    As you can see, there is no report region out of the box that handles this Master-Detail situation.
    Good luck.
    -- Sharon

  • HTTP 404 Error on submit

    I am generating an APEX application page 'region' as a PL/SQL anonymous block using the
    htp.p function. The PL/SQL htp.p dynamically creates radio groups, text links, and buttons from
    database data. It appears that if the generated page is too big (too many items) when one of
    the buttons is pressed to submit the page and refresh it with different data the following error
    is generated:
    'The webpage cannot be found HTTP 404'
    with browser URL: http://sys3:7777/pls/Apex/wwv_flow.accept
    The button executes a javascript function which calls: document.wwv_flow.submit();
    If I remove one radio group item - everything works fine.
    Oracle DB 10g
    Application Express 3.2.0.00.27
    Does anyone have any ideas about this problem?
    Is there a page size limit, or item limit when using htp.p?
    Thanks for any help you can give me.

    Hi,
    have a look at the following blog posting http://www.inside-oracle-apex.com/oracle-apex-got-404-not-found-2/ to get instructions how to get the cause of the 404 error. I think that will help you to solve your problem.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins

  • How can I execute a Procedure with OUT variable is %ROWTYPE on SQL Prompt

    Hi,
    I have a procedure with OUT variable is %ROWTYPE
    How can I execute the following procedure on SQL prompt.
    (without creating anonymous block)
    CREATE OR REPLACE PROCEDURE zz_sp_EMP(VEMPNO IN EMP.EMPNO%TYPE,
    V_REC IN OUT EMP%ROWTYPE)
    AS
    BEGIN
    SELECT * INTO V_REC FROM EMP WHERE EMPNO = VEMPNO;
    END;
    Thanks & Regards,
    Naresh

    as previous posters said: it's not possible to do this without declaring a variable in the anonymous block.
    With anonymous block it would look like this (had to change it a bit, since i'm using hr-schema on oracle XE):
    declare
    l_rec EMPLOYEES%ROWTYPE;
    begin
    zz_sp_EMP(VEMPNO => 100, V_REC => l_rec);
    DBMS_OUTPUT.PUT_LINE ( 'first_name = ' || l_rec.first_name );
    DBMS_OUTPUT.PUT_LINE ( 'last_name = ' || l_rec.last_name );
    end;
    first_name = Steven
    last_name = King

  • Can I call a function with an arguement of %ROWTYPE directly from SQL?

    I have the following function in a 10g DB:
    CREATE OR REPLACE FUNCTION f_is_eligible2 (in_dm_row IN amplify_dm%ROWTYPE)
    RETURN NUMBER
    IS
    I know I can call that function from another pl/sql function but I'm wondering if I can call that function directly from a SQL statement, something like this:
    SELECT f_is_eligible2(dm.*)
    FROM amplify_dm dm
    or
    SELECT f_is_eligible2(dm%rowtype)
    FROM amplify_dm dm
    neither of those worked so I'm thinking it's not possible but I thought I'd ask anyway.
    Thanks in advance!

    Not possible as said - but - based on what I'm seeing - you could simply pass the parameter(s) that are key on that table and - accomplish the same thing by modifying the function.
    not sure why you'd need the whole row if I'm interpretting the code excerpt.

  • Adding pagination in report build from PL/SQL dynamic content using htp.p

    Hi,
    I have a requirement for which i used PL/SQL dynamic content to build my report and i displayed my report using a cursor and loop by HTP.P function.
    Now problem is I have report with more than 500 rows and I want to add pagination concept for this report.
    How can i do that?
    Thanks in advance.
    Regards,
    Smith

    To preserve heading on each page for a HTML table you can use the THEADER, TFOOTER and TBODY tags (see example). To force page breaks, try experimenting with these style attributes:
    <STYLE TYPE="text/css">
         tr.breakhere {page-break-before: always}
    </STYLE>
    <tr class="breakhere">Table Example:
    htp.tableopen;
    htp.print('<THEAD style="display:table-header-group">');
    ... your table headers here
    htp.print('</THEAD>');
    htp.print('<TFOOT style="display:table-footer-group"><TR><TD></TFOOT>');
    htp.print('<TBODY>');
    ... your rows here
    htp.print('</TBODY>');
    htp.tableclose;Edited by: crokitta on Apr 8, 2009 2:07 PM

Maybe you are looking for

  • Unable to Sign in  analytics After Upgraded obiee from 10g to 11g

    Hi all, I have problem when upgrading catalog from 10g to 11g. The error is:" Unable to Sign In . An invalid User Name or Password was entered. " I upgraded following the steps like this: 1.Login EM and check BI server is running successfully. 2.Star

  • Cs6 wont open

    I downloaded CS6 from a CD. After installing I went to open it and the only Photoshop on my computer is CS4 and an error message appears saying "that adobe Photoshop has stopped working". I am very confused and would like some assistance please.

  • Date field is always disabled in qlist form

    Hi,   We are using Qlistform(quest webpart), and observed that when I include a date time field(new form), date field's calendar popup is greyed out, But I can only change the time, but not the date.  Any resolution for this? Thanks, Poonam

  • How to make an internalization [Beginner]

    Hi I'm new to all those internalization stuff. My question is how to do that? I thought that using ResourceBundle class and properties files would be a good solution, but I can't see any proffesional projects making internalization that way. I heard

  • Canoscan 9000f and Mac OS.10.8.2 not compatible. Driver not found on either canon us or uk sites.

    Canoscan 9000f and Mac OSX 10.8.2 not compatible. Install CD gives error. It said when I bought it it would work on Mac OSX 10.8. Searched for drivers on both Canon US and UK sites. Not found. What to do? Thank you.