Home » SQL & PL/SQL » SQL & PL/SQL » Encountered the symbol "(" (merged 3)
Encountered the symbol "(" (merged 3) [message #391742] Fri, 13 March 2009 05:34 Go to next message
krishkumar22
Messages: 4
Registered: March 2009
Location: bangalore
Junior Member
CREATE OR REPLACE PROCEDURE CC_LoadRoadNameCheckAvaliabili
(
v_frid IN NUMBER DEFAULT NULL ,
v_companyid IN NUMBER DEFAULT NULL ,
cv_1 IN OUT SYS_REFCURSOR
)
AS
v_tablename NVARCHAR2(50);
v_Sql NVARCHAR2(2000);
--@Lat numeric(18,10),
--@Lon numeric(18,10)
BEGIN

--SELECT * FROM ADDRESSPOINTS_1
v_TABLENAME := 'Addresspoints';

v_TABLENAME := v_TABLENAME || '_' || CAST(v_frid AS NVARCHAR2(10));

--SELECT * FROM @TABLENAME
--set @Sql = 'SELECT roadname+"|"+LAT+"|"+LON AS RoadName FROM '+ @TABLENAME --+''-- WHERE CompanyId='+@CompanyId+'
v_Sql := 'SELECT lat, roadname+' || '''|''' || '+CAST(LAT AS NVARCHAR(50))+' || '''|''' || '+CAST(LON AS NVARCHAR(50)) AS RoadName FROM ' || v_TABLENAME || ' WHERE ROADNAME IS NOT NULL ORDER BY ROADNAME';

OPEN cv_1 FOR v_Sql;

END;
/
Re: PLS-00103: Encountered the symbol "(" when expecting one of the following: [message #391750 is a reply to message #391742] Fri, 13 March 2009 05:42 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
That would be MS Sql server T-SQL code.

You can't run T-SQL in an oracle environment.

Well, technically, you can run it, but it just won't work.
Re: PLS-00103: Encountered the symbol "(" when expecting one of the following: [message #391751 is a reply to message #391750] Fri, 13 March 2009 05:43 Go to previous messageGo to next message
krishkumar22
Messages: 4
Registered: March 2009
Location: bangalore
Junior Member
just i conver that sp from sql to oracle by SQL developer tool
now i run the procedure in TOAD i am getting that error.
Re: PLS-00103: Encountered the symbol "(" when expecting one of the following: [message #391753 is a reply to message #391742] Fri, 13 March 2009 05:48 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Mea Culpa - I'd not spotted that all the T-SQL was commented out.

CAST is an SQL function, not a pl/sql one.

Try the TO_NCHAR function instead.
Re: PLS-00103: Encountered the symbol "(" when expecting one of the following: [message #391755 is a reply to message #391753] Fri, 13 March 2009 06:00 Go to previous messageGo to next message
krishkumar22
Messages: 4
Registered: March 2009
Location: bangalore
Junior Member
if i replace that particular sentence with like
v_duprecordid := TO_NCHAR(v_duprecordid AS NUMBER(10,0));
i am getting the same error
Re: PLS-00103: Encountered the symbol "(" when expecting one of the following: [message #391756 is a reply to message #391742] Fri, 13 March 2009 06:03 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Use SQL*Plus and copy and paste your session with the error.

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel
Re: PLS-00103: Encountered the symbol "(" when expecting one of the following: [message #391757 is a reply to message #391756] Fri, 13 March 2009 06:06 Go to previous messageGo to next message
krishkumar22
Messages: 4
Registered: March 2009
Location: bangalore
Junior Member
we are using TOAD in our company for oracle we dont know how to use sql*plus,
i am new to the oracle we just convert the code from sql to oracle by sql developer
Re: PLS-00103: Encountered the symbol "(" when expecting one of the following: [message #391760 is a reply to message #391757] Fri, 13 March 2009 06:38 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Get rid of the pluses. If I read it well, they were used in T-Sql for concatenation. In Oracles (PL/)SQL, you use ||
Re: PLS-00103: Encountered the symbol "(" when expecting one of the following: [message #391763 is a reply to message #391755] Fri, 13 March 2009 06:55 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
TO_CHAR and TO_NCHAR convert number (or dates) to strings.

To convert a string to a number, you need to use TO_NUMBER
Previous Topic: how is it possible??? (Column In Rows)
Next Topic: Date and Time comparison query - HELP (2 threads merged by bb)
Goto Forum:
  


Current Time: Sat Feb 08 20:56:43 CST 2025