SQL query returns varchar - default value type!!!

On a field in my portal form there is a default value type of 'SQL query returns varchar', where can I put this sql to get a default value from a table?

Hi again
I have this code in 'additional pl/sql code' - '...before displaying the page'. But it comes up with an error when I run the form.
declare
prop_v varchar2(20);
group_v varchar2(3);
el1_v varchar2(3);
blk varchar2(10) := 'DEFAULT';
begin
prop_v := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT', p_attribute_name => 'l_property_p');
group_v := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT', p_attribute_name => 'l_group_p');
select element_code
into el1_v
from eh_risk_element_detail
where property_ref = prop_v
and group_code = group_v
and line_no = 1;
p_session.set_value(p_block_name => blk, p_attribute_name => 'L_ELEMENT1_P', p_value => el1_v);
end;
Rich

Similar Messages

  • Percentage pie chart whose query return just one value

    Hi,
    I have a requirement which is to display a pie chart that shows the relative percentage of based on a particular row's values.
    Here the SQL query return just one value to generate the chart, however Apex is creating its own seemingly random value to draw the rest of the chart and dividing the region.
    Is there any way for Apex to take the single value that the query returns as a percentage and generate the chart by calculating the other value to be as (100 - queried value) and split the region in the chart accordingly.
    Of course one method is to store both the value that the query returns as well as 100 - that value in a table and then write the query in the chart that references both these values.. but I'd like to know if there is a way to go about it without storing this extra bit of information in a table
    Thanks!

    you create a hidden page item and populate with total value and percentile calculated value and use it in dial chart as querry.

  • Default Value Type

    Hi! All,
    I'am using Oracle portal
    In the form wizard there is an option for using 'defalt value' for any text fiels along with 'defult value type'. I want to know how effectively I can use sql query function written by me or any sql query .And from where can I get the details about this.
    till now I can only used #sysdate in the default value.Also what # denotes.
    Please do help me
    Thakns in advance.
    Regards
    Anil Rath

    Try these:
    1)Default Value = select schema_name.your_function from dual
    Default Value Type = Expression that returns Date
    2)Default Value = select sysdate from dual
    Default Value Type = Expression that returns Date
    3) #Sysdate
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Swati Kale ( ):
    do you mean to say that, if my function name is returnDate and the owner of the function is xyz.
    Then in defualt value,I shd give,
    xyz.returnDate
    and in Default value type,I shd select
    Function returns date.
    advise<HR></BLOCKQUOTE>
    null

  • Default value type - validation option form based on stored procedure

    Please could somebody explain and provide an example of what the option :-
    default value type - in the validation options for a field in the editor for a form based on a stored procedure ?
    Thanks in anticipation.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Dmitry Nonkin([email protected]):
    Absolutely, you can use SQL query to return the value like in the example above:
    Default Value = select 5 from dual
    Default Value Type = 'SQL query returns number'
    or
    Thanks,
    Dmitry<HR></BLOCKQUOTE>
    Hi,
    and what about:
    Default Value = select max(salary) from emp_salaries
    Default Value Type = 'SQL query returns number'
    Will it work? We go some troubles with this.
    Thanx
    Marcin

  • Creating a directory via a jsp page sql query return

    Is it possible to create a directory based on the results of a sql query?
    i.e.
    My sql query returns application number 1234 for a building application (BC for short).
    Is it possible to create a directory /BC/1234
    It is then proposed to use an iframe to look into the directory so users can place and access scanned documents which are captured during the approval process.
    If so how?
    An example would be great.
    Jason

    Sorry hope your still around I've been away for a while. We've created a samber share to the file server where the documents are stored and mounted it within the web file directory. It works ok if there is an existing directory but if there isn't we want it to be created when the page looks for the folder. I've done this with an asp page it basically did a directory exist test first then create folder if it didn't. The problem is can't find an example of how to do the directory exist test then directory create syntax so an example of both would be great

  • Write the sql query to find largest value in row wise without using   great

    write the sql query to find largest value in row wise without using
    greatest fuction?

    Another not so good way, considering you want greatest of 4 fields from a single record:
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (Select 100 col1,200 col2,300 col3,400 col4 from dual
      2  union select 500,600,700,800 from dual
      3  union select 900,1000,1100,1200 from dual
      4  union select 1300,1400,1500,1600 from dual
      5  union select 1700,1800,1900,2000 from dual
      6  union select 2100,2200,2300,2400 from dual
      7  union select 2800,2700,2600,2500 from dual
      8  union select 2900,3000,3100,3200 from dual)
      9  SELECT (CASE WHEN col1 > col2 THEN col1 ELSE col2 END) Max_value
    10  FROM
    11  (SELECT (CASE WHEN col1_col2 > col2_col3 THEN col1_col2 ELSE col2_col3 END) col1,
    12         (CASE WHEN col2_col3 > col3_col4 THEN col2_col3 ELSE col3_col4 END) col2,
    13         (CASE WHEN col3_col4 > col4_col1 THEN col3_col4 ELSE col4_col1 END) col3
    14  FROM
    15  (SELECT (CASE WHEN col1 > col2 THEN col1 ELSE col2 END) col1_col2,
    16         (CASE WHEN col2 > col3 THEN col2 ELSE col3 END) col2_col3,
    17         (CASE WHEN col3 > col4 THEN col3 ELSE col4 END) col3_col4,
    18         (CASE WHEN col4 > col1 THEN col4 ELSE col1 END) col4_col1
    19* FROM t))
    SQL> /
    MAX_VALUE
           400
           800
          1200
          1600
          2000
          2400
          2800
          3200
    8 rows selected.
    SQL> Edited by: AP on Sep 21, 2010 6:29 AM

  • SQL Query returns values like "---" and "NA"

    Hi
              When I execute a sql query in MII it returns values like "---" and "NA" for empty Char and numeric fields respectively.
    I have checked the database and made sure that these fields does not have any value. This happens only when I run the query through MII. Can any one know how can we get rid of these values?
    Thanks in advance
    Shaji

    Shaji,
    MII sets those values as a default if it discovers null values in a query result. You can change this default behaviour in several ways.
    First, have a look at the document [Setting custom null values in XML|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70628af0-8ec4-2c10-7da2-f451e412dd8f?quicklink=index&overridelayout=true]. Then you may also use SQL functions like [NVL|http://www.techonthenet.com/oracle/functions/nvl.php] to change the value directly in the SQL query. You can also change the value inside the MII BLT to whatever you need.
    Michael

  • SQL query returns value but EXEC SQL Task fails to assign variable

    I have an execute SQL task to get an identifier from an Oracle database and assign it to a variable (the variable is used in subsequent query's where clauses to transfer the data to a SQL Server database). If I copy the query from the SSIS
    package to the Oracle SQL Developer interface and run the query; I get the expected single identifier. If I run the execute SQL task I get the error "[Execute SQL Task] Error: An error occurred while assigning a value to variable "VariableName":
    "Single Row result set is specified, but no rows were returned."
    I can create phony/simpler versions of the query that will return the wrong identifier that will successfully assign the value to the variable, so the problem isn't with the variable itself or the way the result set is set up in the task (Result
    Set/Single Row in the General panel; Result Name 0/VariableName in the Result Set panel).
    How can two queries that return a single value produce different results with respect to the variable assignment process?

    Perhaps you can trap (profile) the query in Oracle to see what it gets submitted,
    thing is this query
    select id from table where ProcessedStatusColumn is null and DateColumn = (sub select to get most recent date in table where ProcessedStatusColumn is null)
    is not guaranteed to return a value, you need a default returned in case the search failed e.g.
    select
    NVL(id, 0)
    from table where ProcessedStatusColumn is null and DateColumn =
    (sub select to get most recent date in table where
    ProcessedStatusColumn is null)
    Arthur My Blog

  • APEX,PDF's, BI Publisher and SQL Query returning SQL code..

    I don't know if I should be posting this in this Forum or the BI Publisher forum, so I am posting in BOTH forums..
    I love APEX, let me say that first.. And appreciate the support offered here by the group, but am running int a confusing issue when BI Publisher tries to build a report from the above type APEX report..
    Here is my dilemma:
    I have a number of reports that are part of a Oracle package. They return an SQL Query back to a reports region on a page. I am having to deal with the column names returned are col01, col02..
    The issue I have is, when building the Application Level query to download the XML sample from in building RTF layouts in Word, you can not use this code, you MUST use a standard SQL Select.
    I have taken the sql from the function returning sql, and copied into the application query, supplying the required data values for bind variables being used in the query.
    An XML file is produced, and I use this to build the RTF format file that I load back into APEX and try to use it for the PDF rendering of the report. I can view the output as a PDF in the Word add on, but when I try using it with the report, it is returning an empty PDF file.
    Can anyone tell me what error log files on the bi publisher side I can look at to see what error is happening?
    Thank you,
    Tony Miller
    UTMB/EHN
    Title adjusted to allow people to know what I am talking about...
    Message was edited by:
    Tony Miller

    Tony,
    You can find the log as follows:
    - go to http://[yourserver]:[yourport]/em
    - logon to OC4J EM: oc4jadmin/[yourpassword]
    - click on "logs" at the bottom of the page
    - in the hgrid/tree, expand OC4J->home->Application
    xmlpserver
    - click on view log icon
    You can also observe what's going on in BI Publisher
    by going to the command prompt from where you started
    it.
    Or, as a third option, you can locate the file on
    your file system, depending on your setup, the path
    would be something similar to this:
    \oracle\product\10.2.0\bip\j2ee\home\application-deplo
    yments\xmlpserver\application.log
    With that said though, I don't expect you'll find
    much in there that would help with your particular
    problem. I suspect you either get no rows in your XML
    at runtime, due to some session state issues, or your
    XML structure does in fact not match your RTF
    template.
    I'm not quite following your problem description,
    i.e. when did you do what and are you associating
    your report layout with a report query or report
    region. So just some general notes, your query needs
    to be parseable at design-time, when exporting the
    XML, so that you get the XML file with the proper
    column names derived from your query. If you want to
    use your RTF template with a standard report region,
    you must export the XML file first using the advanced
    XML structure option. And of course the column names
    in your report query need to match the column names
    in your report region.
    Perhaps this helps you further diagnose what's going
    on, if you have additional information that could
    help, let me know. And if you could stage this on
    apex.oracle.com, I'd be happy to take a look.
    Regards,
    MarcMarc,
    Thanks for looking at this issue. Below find my remarks to your questions..
    Re: your query needs
    to be parseable at design-time, when exporting the
    XML, so that you get the XML file with the proper
    column names derived from your query.At the start of this process, the query code was a function in a package. The function was returning an SQL select statement, for a report region on a page. I took the select statement, built an application query to build a sample of the xml for BI Publisher desktop (Add-on for Word). The code was producing the usual Col01, Col02.. since at design time that is were the column names.
    When I then took the xml from this and built the rtf for loading into my APEX application.
    When testing the Application Query with this RTF report layout, I am getting PDF's. When using it with the report region sending an xml feed to BI Publisher I am getting nothing back.
    I have since taken the sql code and moved it back into the report region, and set the region to have a type of straight SQL Query. I have even tried to hard-code the parameters I was getting from the page to limit data returned.
    Is it possible to see the xml being produced by the APEX page?
    Re: Stage this on apex.oracle.com.. I would love to, but we would have HIPPA issues if I posted the data on a public website.
    Can I send you the RTF file and the xml file that the application query is creating to see if there something weird about them?
    Thank you,
    Tony Miller
    UTMB/EHN

  • Exists (SQL query returns at least one row) condition with MAX on 10.2.0.4

    I just wanted to note this on the forum..
    I'm using Apex 3.0.1.00.08
    My DEV environment has just been upgraded from 10g version 10.2.0.2.0 to 10.2.0.4.0.
    I created the following process to select some values into some items on my Form page.
    select  MAX(STAT_YEAR+1)
          , pcd.pct_id
          , pcd.stat_type_id
          , pcd.stat_period_type_id
          , pcd.measurement_id
    into    :P11_STAT_YEAR
          , :P11_PCT_ID
          , :P11_STAT_TYPE_ID
          , :P11_STAT_PERIOD_TYPE_ID
          , :P11_MEASUREMENT_ID
    from  plant_commodity_data pcd
        , stat_type stt
    where pcd.STAT_TYPE_ID = stt.STAT_TYPE_ID
      and pcd.pct_id = :P0_PCT_ID
      and stt.stat_type = 'PRD'
    group by pcd.pct_id
          , pcd.stat_type_id
          , pcd.stat_period_type_id
          , pcd.measurement_id;The process should run conditionally if there was at least one row to select...
    So I copied the SQL into the Process condition, removed the "into" section and set the condition type to be "Exists (SQL query retruns at least one row) ...
    select  MAX(STAT_YEAR+1)
          , pcd.pct_id
          , pcd.stat_type_id
          , pcd.stat_period_type_id
          , pcd.measurement_id
    from  plant_commodity_data pcd
        , stat_type stt
    where pcd.STAT_TYPE_ID = stt.STAT_TYPE_ID
      and pcd.pct_id = :P0_PCT_ID
      and stt.stat_type = 'PRD'
    group by pcd.pct_id
          , pcd.stat_type_id
          , pcd.stat_period_type_id
          , pcd.measurement_id;This worked perfectly until the DEV environment was upgraded from 10g version 10.2.0.2.0 to 10.2.0.4.0.
    The condition would fire even if there were no rows returning.
    I pasted the condition code into SQL Developer connected to the DEV (10.2.0.4.0) environment and it returned no rows.
    To solve the problem, I removed the MAX.
    You can test this using this code if you have access to the two versions... select  MAX(1)
          , sysdate
          , 'Gus'
    from  dual
    where 1 = 2
    group by sysdate, 2Now I know the MAX isn't required in the condition as I'm just trying to find out if any rows exist, but it was there as I copied the code in... I was just wondering why this happened between 10.2.0.2.0 and 10.2.0.4.0?
    Gus..

    Hi Gus,
    try to execute
    select count(*) from dual where exists (select  MAX(1)
          , sysdate
          , 'Gus'
    from  dual
    where 1 = 2
    group by sysdate, 2)in SQL Developer. The above statement is generated by APEX for an "Exists (SQL query retruns at least one row)". Can't test it, because I don't have a 10.2.0.4.0 at hand.
    Does SQL Developer now show the same behavior?
    Patrick
    My APEX Blog: http://www.inside-oracle-apex.com
    The APEX Builder Plugin: http://builderplugin.oracleapex.info/
    The ApexLib Framework: http://apexlib.sourceforge.net/

  • SQL Query to find cumulative values for a Financial Year

    Dear users,
    My requirement is to create a SQL query for a table/view where I have day-wise data. I want to find out cumulative values for financial year by giving any date. It should add the values from start of financial year till that date in the financial year.
    I think creating a view of such type will post heavy burden on resources since accuimulation will be done for each day upto that day.
    Thanks

    Dear users,
    My requirement is to create a SQL query for a
    table/view where I have day-wise data. I want to
    find out cumulative values for financial year by
    giving any date. It should add the values from start
    of financial year till that date in the financial
    year.
    I think creating a view of such type will post heavy
    burden on resources since accuimulation will be done
    for each day upto that day.
    ThanksKumar's solution will serve yours purpose but m not agreed
    I think creating a view of such type will post heavy
    burden on resources since accuimulation will be done
    for each day upto that day. Khurram

  • SQL Query returns question marks

    I am seeing a SQL Query, executed via ADODB in VB, from a 10G client (don't know exact version) to a Sun Solaris based 9.2.0.5.0 Server return all question marks...Table queried consists of 3 columns, 2 varchar2, one long: Here query:
    SELECT SETTINGVALUE FROM EWORKFLO.CONFIG WHERE SETTINGGROUP='New test' AND SETTINGNAME='Single Page'
    The query results in 2576 question marks...(????? etc).
    Any idea what may be going on here?
    Thanks...
    Leendert

    Hello Tak,
    Thanks for replying. When this query is run from SQLPLUS we get a proper result back, that is the actual values from the SETTINGVALUE column. This is the LONG column and contains data like this:
    [Scan Section]
    DeviceTimeout=15
    Display=1
    hDCCreate=0
    Unit=0
    DialogTitle=
    IniFileName=c:\winnt\temp\kf.ini
    IniSectionName=Scan Section
    DeviceCache=1
    etc....etc....
    Depending on the settings created, the return string may vary in length.
    Leen

  • BI 7.0 Order of Query front end default value fields

    Hello,
    I have a ordered the default values in query designer, but when I display the query in bex web analyzer, the order of the dimension variables is not in the same order as I specified in query designer.  It does not appear to be alphanumeric or even based ont the technical name.   How can I control the order of the default values?
    Thanks for any information
    Lee Lewis

    Simply go to the query properties and here you can re-order the charachteristics

  • Infoset-query-selection-screen-default-values

    Hi All,
    I am having the requirement as I need to put default values in the selecion-screen of the report by using  Infoset query. Let me know the settings required for this.
    I am using SQ01, SQ02, SQ03 T.Codes.
    And I need display  one record only if any field contains mulitple records, for example in the HR-ABAP, field p0105-usrid contains multiple values depending on the subtype.So, I need to display USRID when URSTY = '900'. All these should display by Infoset query only.
    Pls help me in this scenario , its an urgent requirement.I am very much thankful for you for reading my proble, if you will provide some sort of solution, I feel very happy.
    Advance thanks for this .
    Regards,
    Prakash.

    Prakash,
    To default the values on your selection screen, you will need to do some ABAP I guess. (if you do not want to use variant). Open up the infioset in SQ02 and then goto code option for the PNP**** field and then you can code to initialize the selection screen variables. Test with an ABAPer.
    To display multiple records as multiple columns, you will have to create custom fields in infoset, and then go from there. Again see ABAPer.

  • SQL Query constructing  for searching values in Tables single Column

    I have Table USER_SERVICES with 2 Columns USER_NAME, Services. Please find below sample data on USER_SERVICES Table.
    A user can be assigned with multiple services(service1, service2 etc.,). So we store data as below :
    USER_NAME Services
    user1 service1
    user1 service2
    user1 service3
    user2 service1
    user2 service2
    user3 service3
    user4 service4
    I need to frame a SQL Query to 'select users assigned with Service A and Service B and Service n'.
    Note: 'And' condition is used when Searching for multiple services.
    Example: The SQL Query has to dynamically handle condition if i give Single Service, multiple Services(service1 and service2 e.t.c,)
    If i say select users assigned with service1 and service2, from the above Table, result should be user1 and user2
    If i say select users assigned with service1 and service2 and service3, from the above Table, result should be user1
    If i say select users assigned with service4 from the above table, result should be user4
    If i say select users assigned with service1 from the above table, result should be user2,user1
    If i say select users assigned with service1 and service2 from the above table, result should be user2,user1
    How do i construct the SQL Query. Any help will be appreciated.
    Thanks,
    Sathish
    Alternate email: [email protected]

    How it will be stored? In a string or a table or a collection type?
    If you have it in a table you can do like this.
    with t
    as
    select 'user1' user_name, 'service1' services from dual union all
    select 'user1', 'service2' from dual union all
    select 'user1', 'service3' from dual union all
    select 'user2', 'service1' from dual union all
    select 'user2', 'service2' from dual union all
    select 'user3', 'service3' from dual union all
    select 'user4', 'service4' from dual
    t1 as
    select 'service1' services from dual union all
    select 'service2' from dual
    select distinct user_name
      from (
    select t.user_name, t.services, t1.services, count(t1.services) over(partition by t.user_name) cnt, t1.cnt cnt_1
      from t
      left join (select t1.*, count(*) over() cnt from t1) t1 on t1.services = t.services
    where cnt = cnt_1

Maybe you are looking for

  • When shutting down Win XP Pro I get a message

    When trying to shut down Win XP Pro I get the message having to do with BdDevMgrDeviceListener, and will not end program without manual delete or click on End Program, how do I fix that?

  • Is it possible to pass files as arguments to executable jars in windows?

    Hi, I've searched through the forums a bit and couldn't find any good info... basically, I'd like a user of my jar file to be able to drag and drop a file onto my jar file, and have the jar file process that file. Anyone know if this is possible? I'd

  • Errors while Installing Oracle Xpress XE on Linux (Suse 11.2)

    Hi everyone, i tried to install Oracle XE on a Linux System. But i got several Errros during the Installation : Paket "oracle-xe-10.2.0.1-1.0.i386" Executing the Package got following Errors : Start with : rpm - ivh oracle-xe-10.2.0.1-1.0.i386.rpm La

  • Mac G£ (B&G) OS 10.3.9 - Difficulties installing OS 10.4

    I purchased OS 10.4 with the intention of upgrading my son's Mac G3 from OS 10.3.9. to OS 10.4 as he wishes to use iMovie HD. I have thus far failed to do that despite numerous attempts and, I think, following all the advice in the installation guide

  • Using Function Keys and Alt Key in Flash Video

    I am attempting to create an eLearning video, which includes instructions, a "try it yourself" section, and then a quiz.  Our software that I am trying to simulate uses Function keys (F6 to bring up specific windows) as well as shortcut keys (Alt-S t