Html in sql query

hello experts;
I have a query similar to this below
create table tbl_test as
select tp.id from
select '180 main st' as ID from dual
union all
select '190 main st' as ID from dual
) tpI am trying to make the id field an hyperlink, so that when it is clicked on it passes the associated id into the link and navigate the user to the site, the only problem is the syntax. this is what i have done so far all
select '<A STYLE="font-size: 80%;" HREF="https://maps.google.ca/maps?q=' + ty.id   + '" TARGET="_blank"> ty.id </A>'
from tbl_test tyall help is appreciated. thank you

Hi,
The operator for concatenating strings in Oracle is || (not + ).
Also, what should the user see as the link: 'ty.id', or something like '180 main street'? If ty.id is inside single-quotes, that means literally those 5 characters. If it's outside of the single-quotes, then the value of the column ty.id is meant.
Try this:
SELECT  '<A STYLE="font-size: 80%;" HREF="https://maps.google.ca/maps?q='
     || ty.id  
     || '" TARGET="_blank"} '   -- replace }; see note below
     || ty.id
     || ' </A>'
FROM      tbl_test ty
;NOTE: This site often does strange things when you have a line with unbalanced angle-brackets. I wanted to use a &gt; symbol in place of } above, but that causes the rest of the line, and the next 2 lines, to disappear. After you copy this, change the } to a &gt;.
Edited by: Frank Kulash on Feb 27, 2013 4:00 PM

Similar Messages

  • SQL Query as Item Source/Oracle Reports w/ HTML DB?

    I have successfully used a SQL Query as an item source in the past on several occasions. However, in this instance, every time I try to do this, I get the following error:
    Error ERR-1019 Error computing item default value: page=3 name=P3_TEST_ITEM.
    ORA-01460: unimplemented or unreasonable conversion requested ORA-02063: preceding line from [database_name]
    If I use the exact same query in creating a report region, the page displays fine and the query returns the correct data. Why might this be happening, and what can I do to fix it?
    Also - off the subject - is there a way to use HTML DB to deploy reports that are created in Oracle Reports Builder? I have created several employee productivity reports for supervisors and managers in HTML DB, which is great for allowing them to run them live and have fields as parameters for varying employees, date ranges, etc... but formatting them to be browser and printer friendly is an absolute nightmare so far. If I could create and format the reports in Reports Builder and then deploy them using HTML DB, while still being able to offer parameters to the user, that would be perfect. Is this possible?

    Here is my query:
    SELECT
    TO_CHAR((sum(decode(ef.production_function,'Y',ef.function_minutes+ef.function_ot_minutes))/60)/8, '9999999.99')
    FROM
    RLAPPLSG.EMPLOYEE_INFO@REMOTE_SERVER EI,
    RLAPPLSG.SC_EMP_FUNCTIONS@REMOTE_SERVER EF,
    RLAPPLSG.SC_EMP@REMOTE_SERVER E
    WHERE
    ( e.SC_EMP_NBR=ef.SC_EMP_NBR )
    AND ( ei.EMP_ID=e.EMP_ID )
    AND (
    ( trunc(( e.SC_DATE )) BETWEEN :P2_BEGIN_DATE AND :P2_END_DATE )
    AND (ei.EMP_MGRS_ID = :P2_SUPERVISOR_ID
    OR ei.EMP_ID = :P2_SUPERVISOR_ID)
    Every table and/or view that is referenced here is done so remotely. The column datatype breakdown is as follows:
    production_function - BOOLEAN
    function_minutes - NUMBER
    function_ot_minutes - NUMBER

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • Need to run a sql query in the background and display the output in HTML

    Hi Guys,
    I have a link in my iprocurement webpage, when i click this link, a query (sql query) should be run and the output should be displayed in a HTML page. Any ideas of how this can be done. Help appreciated.
    We dont have OA Framework and we r using 11.5.7.
    help needed
    thanx

    Read Metalink Note 275880.1 which has the link to developer guide and personalization guide.

  • Can HTML-based reports be built in BLS via an SQL Query and XSLT?

    Hello xMII experts,
    I have already built a report in xMII which uses XSLT to provide group/sum totals in a web browser. However in a new project, the report must run at certain times and possibly when certain signals become true in the process.
    It appears that BLS is a good choice to achieve this and my proposed Transaction was:
    1. SQL Query Action(uses the same QueryTemplate as in xMII)
    2. XSLTransform Action on the resulting XML resultset (The .xsl file contains HTML which is the original used in xMII to produce the report there)
    3. HTML Loader action with the resulting output of the transformation
    I have now got some output in the resulting HTML file - however it omits all XSLT code - and I am left with an empty HTML shell but for a few images.
    This indicates that perhaps no SQL data was ever returned.
    I have therefore two questions:
    1. How can I check if the SQL returned data?
    2. Is it possible to deliver data to a HTML file directly after an XSLTransformation.
    Looking forward to your responses
    Best Regards
    Robert Sales

    Thank you for the replies.
    I am a little closer the result I need - however I think I need to explain what I had and what I need a little better.
    Before BLS
    1 xMII report page (.irpt extension) with two iCalendar applets (start/end date) and a set of buttons (1 for each report)
    Upon clicking on a button the two dates are passed into an .irpt file, and via a servlet an SQL QueryTemplate and a XSL DisplayTemplate are used to build the report.
    The HTML is embedded in the XSL file - thereby generating the report direct in the web browser.
    - This all works fine
    With BLS
    A transaction which uses a modified SQL QueryTemplate (no date parameters) passing the results to an XML file. This works.
    Now when I click on the button in my xMII screen the .irpt file is called with no Date parameters and the xAcute QueryTemplate called with the XSL DisplayTemplate. The irpt file has <html> and <body> tags with XSL file in the Servlet call providing the tables and data extraction from the XML.
    I have no additional HTML file so I placed the iframe tag inside the XSL file - but it refers to the .irpt file - this doesn't sound right!
    I do get a little output in the web browser but it still omits all XSLT code.
    One more point - The Transaction can be scheduled and run as required - but I need the entire report to created and stored for viewing at a later date. Will a servlet tag running inside an .irpt file achieve this?
    Sorry for the chaotic writing here - but I must leave the office.
    Regards
    Robert Sales

  • SQL Query in HTML

    Hi,
    I've been trying to create a header using HTML. I was wondering how I can put an SQL query inside HTML codes.
    Here are HTML code and SQL Query:
    HTML:
    <table width="100%" height="135" border="0">
    <tr>
    <td width="100%" bgcolor="#FFFF33"><span class="style9"><br></span><span class="style9"></span></td>
    </tr>
    <tr>
    <td width="100%" bgcolor="#FFFFCC"><span class="style6"><br>
    FOCUS LIST <span class="style8">FUND FACT SHEET</span></span><br>
    <span class="style7">THIS IS WHERE THE SQL QUERY WILL RETURN <br>
    <br>
    </span></td>
    </tr>
    </table>
    SQL Query:
    select     "MFR_STRATEGY_INFORMATION"."SI_NAME" as "SI_NAME"
    from     "MFR_STRATEGY_INFORMATION" "MFR_STRATEGY_INFORMATION",
         "MFR_POOL_MONEY" "MFR_POOL_MONEY",
         "MFR_MSTAR_FEED" "MFR_MSTAR_FEED"
    where "MFR_MSTAR_FEED"."MSF_FUNDID"="MFR_POOL_MONEY"."F_MSF_FUNDID_FK"
    and     "MFR_STRATEGY_INFORMATION"."SI_SYS_ID"="MFR_POOL_MONEY"."F_SI_SYS_ID_FK"
    and      "MFR_MSTAR_FEED"."MSF_SECID" =:P55_SECID

    Hello,
    Create a hidden item and specify as source your select statement so the item contains the value you want.
    In your html region you specify the item like &P1_ITEM. and you should see the value.
    Regards,
    Dimitri
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/
    REWARDS: Please remember to mark helpful or correct posts on the forum

  • SQL query result with HTML Data in output

    Hello,
    I have a SQL table , in one column I store HTML data. I need to query the table and get the HTML data in the columns that have 'HREF'. The output shows as grid on the sql management studio, however when I export it to excel, the HTML data does not get copied
    correctly, since there are HTML tags etc.
    How can I export the report correctly from SQL ?

    Hello,
    The HTML data is stored in a column with datatype as nvarchar(max). Sample data in the column is shown below. It is with formatting etc and is rendered as is on the web page. the business wants to generate a quick report so that they can see the pages that
    have links displayed. I can do that by querying the columns that have a 'HREF' in the text.
    Can I get the exact HREF values using just sql query? There can be more than one links on a page.
    Also, If I just want to copy the whole column and paste it on excel, how can I do that? If I copy the data below and paste, it does not get copied in one cell.. it spreads across multiple cells, so the report does not make any sense.
    <br />
    <table border="0" cellpadding="0" cellspacing="0" style="width: 431pt; border-collapse: collapse;" width="574">
    <tbody>
    <tr height="19" style="height: 14.25pt; ">
    <td height="19" style="border: 0px blue; width: 431pt; height: 14.25pt; background-color: transparent;" width="574"><a href="https:"><u><font color="#0066cc" face="Calibri">ax </font></u></a></td>
    </tr>
    </tbody>
    <colgroup>
    <col style="width: 431pt; " width="574" />
    </colgroup>
    </table>

  • How to pass sql query to html region

    Is it possible to pass the results of a sql query (say in a page process) to javascript in an html region on the same page?

    Anton,
    Thank you very much for your useful answer. Yes, the page item will work for a query that returns one row. I am not aware how to duplicate this functionality for a query that returns multiple rows.
    I am trying to use this method in order to send time series data to a third-party charting engine required to produce specific types of charts that HTML DB cannot build itself.
    I can cause the third-party chart server to build a chart on an HTML DB page with static data by using pure html or javascript. But I am not sure how to send the full time series to the server as I would say on a jsp page.

  • HTML Files on a SQL Query

    Hi All,
    How can we save the results of a sql query in a html files. Am using HTMLDB.
    How to 1. Create HTML files from a sql query in the client drive
    2. Store the HTML File into a specified drive (mapped drive)
    Kindly help.
    Thanks in advance

    You cannot. Not with HTMLDB aka web app server architecture.
    The application tier of HTMLDB resides in Oracle. The user connects to the web tier (Apache).
    Basic architecture. Web user sends a request to web server. Web server processes the user's request, opens a connections to Oracle and runs the application (HTMLDB) in the Oracle Server.
    The application (HTMLDB), within the client-server context, services the web tier. The web tier is its client. The Oracle/HTMLDB server has no idea (and is not interested) in who/where/how/what the web server is in turn servicing. IT IS NOT ITS PROBLEM.
    To deliver that file to the user's drive (if that is the requirement), is the problem of the web server. Not the application tier (HTMLDB) that runs on the Oracle Server. Very likely, the Oracle Server will not even be able to communicate directly with the web user - due to proxies, firewalls, and so on.
    This is why HTMLDB allows you to design the output of a HTML report to be downloadable as a CSV file. This means that instead of returning a Mime Type of TEXT/HTML to the web server and have the web server passing that along to the web user, it returns TEXT/CSV. The browser is (usually) configured to either save that contents it receives from the web server as a file, or to launch a spreadsheet application (Excel/OpenOffice) to receive that data.
    As for submitting a file as a SQL query from a local drive... that is the web user's problem. And the web browser. It needs to have a mechanism in order to provide that file's contents to the web server for processing. The web server talks HTTP - thus that file must be submitted via HTTP. Mapping drives uses NetBIOS as a protocol.. which is something completely different.
    And again, this has nothing to do with the HTMLDB application layer inside Oracle (it will process whatever the web server passes to it).
    Having clients sharing their drives for write access (in order to allow a server to write to it).. that is truly a Horrible Idea (tm). It will open HUGE security holes in a network. It is contrary to the fundemental principles and concepts of designing web-based systems.

  • Generate html from database before runtime (infrequent sql query)

    Hi,
    I have a SQL query which I want to use to update one section of my web page but the data only changes once a month.  I don't need a dynamic page where the results are executed against the database every time the page is opened (results display on the main index.htm of my web site).
    Is there some way to configure DW (preferably DW CS3) so that it will query the database and insert the results into my static html page being edited on my machine?
    Is there a general technique for including SQL data in static web pages in DW?
    Thanks,
    G

    tx for the tip.
    reason: gobaddy's mysql servers are slow pokes.  i have a larger application where the list would be a dozen or more pages long and only the last entry changes with my update each month.  figured I'd generate all the pages and then just update the first one but your method is the same thing minus all the fuss of screwing around with the first page all the time.

  • Customizing the HTML for a Report from SQL Query

    Hello
    I have created a Report from a SQL query that outputs a list of items from a single table column. There are 65 rows returned by the report. I would like to display all the results on one page but the length of the list prevents this. Is there any way of presenting the results as multiple columns on the same page?
    ie
    Res1 Res2 Res3
    Res4 Res5 Res6
    or
    Res1 Res3 Res5
    Res2 Res4 Res6
    I thought about using a 3 column portlet region and attempting to customise the report displayed via each of the portlets but I would prefer to avoid this as it would require the development and maintenance of an additional template.
    Thanks
    Lisa

    Problem solved...
    I have used my SQL query as a cursor in a dynamic page and then used the cursor and htp.p statements to tabulate my results as per my requirements.
    Lisa

  • Text area with html editor based on sql query

    Hi all,
    I am trying to create a text area with its contents loaded from a sql query returning a blob field.
    I gave the query
    select blob_field from file_subjects where id=41; in the item source valueI am getting an error in the display page like
    ORA-00932: inconsistent datatypes: expected NUMBER got BLOB
         Error      ERR-1019 Error computing item default value: page=5 name=CONTENTS.
    where am i goig wrong..?
    should i go for a pl/sql instead?

    Venket,
    See my previous thread on this (Well I used CLOB rather than BLOB). You will find code examples too. Should be just what you need.
    How to "Bypass" HTMLDB
    -Joe

  • HTML-DB 1.6 SQL Query (Concatenate two columns)

    Hi everyone,
    My query look like this. But I got this message
    ORA-01403: no data found
    Sql query(.....returning ... sql
    What I can do ? I want to concatenate my two columns in one.
    <pre>
    -----Résultats de la recherche
    BEGIN
    DECLARE
    requete varchar2(5000);
    v_code_type varchar2(2000);
    v_ordre varchar2(500);
    BEGIN
    :P1_NOM_BENEFICIAIRE := REPLACE(:P1_NOM_BENEFICIAIRE,' ', '%');
    :P1_NOM_BENEFICIAIRE := REPLACE(:P1_NOM_BENEFICIAIRE,'-', '%');
    requete := 'SELECT
    (FEUI.NOM_BENEFICIAIRE || ''--'' || FEUI.PRENOM_BENEFICIAIRE) ABC,
    FEUI.VALEUR_ID_BENEFICIAIRE,
    FEUI.MONTANT,
    FEUI.CODE_TYPE_DECLARATION,
    FEUI.ANNEE_FISCALE,
    FEUI.CODE_ENTITE,
    FEUI.ID_FEUILLET_IMPOT,
    FEUI.ID_AMENDEMENT,
    FEUI.NO_RELEVE_ORIGINAL_PROV,
    FEUI.ACRONYME_ID_BENEFICIAIRE,
    TYPD.SIGNIFICATION
    FROM
    S29_FEUILLET_IMPOT FEUI,
    S29_TYPE_DECLARATION TYPD
    WHERE
    (TYPD.CODE = FEUI.CODE_TYPE_DECLARATION) AND
    (ANNEE_FISCALE = :P1_ANNEE_FISCALE) AND
    (CODE_ENTITE LIKE ''%'' || SUBSTR(:P1_CODE_ENTITE,1,3) || ''%'') OR
    (CODE_ENTITE = SUBSTR(:P1_CODE_ENTITE,1,3))
    AND
    ((:P1_NAS IS NULL) OR (:P1_NAS = VALEUR_ID_BENEFICIAIRE))
    AND
    ((:P1_NEQ IS NULL) OR (:P1_NEQ = VALEUR_ID_BENEFICIAIRE))
    AND
    ((:P1_NOM_BENEFICIAIRE IS NULL) OR
    ((UPPER(NOM_BENEFICIAIRE) || UPPER(PRENOM_BENEFICIAIRE))
    LIKE ''%'' || UPPER(:P1_NOM_BENEFICIAIRE) || ''%'') OR
    ((UPPER(PRENOM_BENEFICIAIRE) || UPPER(NOM_BENEFICIAIRE))
    LIKE ''%'' || UPPER(:P1_NOM_BENEFICIAIRE) || ''%'') OR
    ((UPPER(RAISON_SOCIALE_LIGNE_1) || UPPER(RAISON_SOCIALE_LIGNE_2))
    LIKE ''%'' || UPPER(:P1_NOM_BENEFICIAIRE) || ''%'') OR
    ((UPPER(RAISON_SOCIALE_LIGNE_2) || UPPER(RAISON_SOCIALE_LIGNE_1))
    LIKE ''%'' || UPPER(:P1_NOM_BENEFICIAIRE) || ''%'') OR
    (UPPER(SUBSTR(COORDONNEE_BENEFICIAIRE_SYGBEC,1,80))
    LIKE ''%'' || UPPER(:P1_NOM_BENEFICIAIRE) || ''%'')
    IF (:P1_CODE_RELEVE = 'A') OR
    (:P1_CODE_RELEVE = 'M') OR
    (:P1_CODE_RELEVE = 'C') THEN
    v_code_type := '(
    (FEUI.CODE_TYPE_DECLARATION = ''A'') OR
    (FEUI.CODE_TYPE_DECLARATION = ''M'') OR
    (FEUI.CODE_TYPE_DECLARATION = ''C'')
    else
    v_code_type :=
    (:P1_CODE_RELEVE = CODE_TYPE_DECLARATION) OR
    (:P1_CODE_RELEVE = ''%'')
    end if;
    WWV_FLOW.DEBUG('V_CODE_TYPE EST EGALE A :' || v_code_type);
    v_ordre := 'ORDER BY NOM_BENEFICIAIRE, VALEUR_ID_BENEFICIAIRE,
    ID_FEUILLET_IMPOT, ID_AMENDEMENT';
    requete := requete || ' AND ' || v_code_type || v_ordre;
    RETURN requete;
    END;
    END;
    </pre>
    Thanks. Bye

    Thank you Scott,
    I'm sorry, I should present you a reduce sql command.
    I had construct my "long" sql command without concatenation. But, I decide to add a column just beside the other column.
    After sending my message on OTN, I tried something else, I decided to copy my sql command without concatenation in an other region. I changed my sql command in the new region by adding my new column and this ''--'' and it works very well. Sometimes, It's really difficult to understand why it doesn't.
    Thanks. Bye,

  • How to set a sql query time out with jdbc:oracle:thin

    should i change the JDBC driver with jdbc:oralce:XA:thin or other driver with XA?

    SQL query timeout may be set with setQueryTimeout.
    http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#setQueryTimeout(int)
    A query timeout bug is fixed in Oracle JDBC Drivers release
    10.1.0.2.0 (10g)
    FIXED BUG-2249191
    In the Server Internal Driver, setting the query timeout does not
    +(and likely will never) work. The query execution will not be+
    canceled when the timeout expires, even if the query runs forever.
    Further, after the query returns, the execution of your code
    may pause for the length of the timeout.
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_readme101020.html

  • How to construct a sql query when field having single quote

    Hi all,
    I have been working on web application , here is my requirement:
    I'm constructing sql statement dynamically from dynamic user input (form data). In one of the field having single quote.
    while executing the query it is getting problem because of single quote .. so how do i resolve my problem.
    single quote should be there. (I'm using Ms-Access as my database).
    Thanks in advance
    abel

    Use PreparedStatement. Always. It not only eases setting Java objects in a SQL query, but also protects you against SQL injections.
    Prepare yourself: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html].

Maybe you are looking for