not Problems inserting   with PL/SQL Developer




insert using & in sql (3)

I have the following script that I want to insert into a table, but I'm having some issues with it.

declare
    v_xslt9 varchar2(32767) := '<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8" indent="yes"/> <xsl:template name="Template"> <xsl:text>Kære </xsl:text> <xsl:value-of select="/nameValueMap/entry[string=''FIRST_NAME'']/string[2]"/> <xsl:text>&nbsp;</xsl:text> <xsl:value-of select="/nameValueMap/entry[string=''LAST_NAME'']/string[2]"/></xsl:template> </xsl:stylesheet>'
begin
    insert into XSLT values ('','Note',sysdate,v_xslt9,sysdate,'T','')
end;

The part of interest is the following

<xsl:text>&nbsp;</xsl:text>

I'm using PL/SQL Developer and when I run the script above it recognises

&nbsp;

as an entity and I then have to type in what value I want in it. What I want is a simple whitespace within the XSL such that the first and last name will be separated. I've tried all suggestions from the following link: orafaq - I just cant get it to work. Either it fails when I try to insert or it fails when I extract the data.

Is there some easy way of inserting a whitespace in the XSL?


Answer #1

Use a command window instead of a SQL window to run scripts in PL/SQL Developer. To transform one kind of window into another type, just right-click anywhere in the window and select "Change Window to" => "Command Window".

Then run your script as in SQL*Plus -- in this case with SET DEFINE OFF as the first line.


Answer #2
<xsl:text>&&nbsp;</xsl:text>

From the PL/SQL Developer manual:

If you wish to use an ampersand in the SQL text that should not be interpreted as a substitution variable, use a double ampersand instead.


Answer #3

use

'<xsl:text>'||'&'||'nbsp;</xsl:text>'

it will solve problem everywhere and forever, and as well as for you - for every future user.

Just isolate the symbol