Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
john20
Starting Member
30 Posts |
Posted - 2008-08-18 : 06:05:57
|
| Hi All,I am creating SP using toad editor and it is giving me some syntex error as i am very new to toad.Procedure syntex is:CREATE PROCEDURE [dbo].[AdvSearch] @UserID int,@SearchStr nvarchar(50)ASBEGINSET NOCOUNT ON;Selectd.*FromUser d inner join Permission a on d.UserID = a.UserID Whered.Name like @SearchStr + '%'ANDa.ID IN (Select ID From Children Where ChildID=@UserID )ANDa.See > 0 ENDcan you please tell me where i need to make changes.Thanks in advance-john |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-18 : 06:09:38
|
quote: Originally posted by john20 Hi All,I am creating SP using toad editor and it is giving me some syntex error as i am very new to toad.Procedure syntex is:CREATE PROCEDURE [dbo].[AdvSearch] @UserID int,@SearchStr nvarchar(50)ASBEGINSET NOCOUNT ON;Selectd.*From[User] d inner join Permission a on d.UserID = a.UserID Whered.Name like @SearchStr + '%'ANDa.ID IN (Select ID From Children Where ChildID=@UserID )ANDa.See > 0 ENDcan you please tell me where i need to make changes.Thanks in advance-john
user is a keyword. so use it within [] |
 |
|
|
john20
Starting Member
30 Posts |
Posted - 2008-08-18 : 06:15:31
|
| Hi Thanks for your reply.did the changes it is giving me error on line 1.Below are the errors:ERROR line 1, col 18, ending_line 1, ending_col 18, Found '[', Invalid identifier: [ERROR line 1, col 19, ending_line 1, ending_col 21, Found 'dbo', Expecting: . -or- TIMESTAMP -or- WRAPPED -or- ( -or- AUTHID -or- AS IS-john |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-18 : 06:21:02
|
quote: Originally posted by john20 Hi Thanks for your reply.did the changes it is giving me error on line 1.Below are the errors:ERROR line 1, col 18, ending_line 1, ending_col 18, Found '[', Invalid identifier: [ERROR line 1, col 19, ending_line 1, ending_col 21, Found 'dbo', Expecting: . -or- TIMESTAMP -or- WRAPPED -or- ( -or- AUTHID -or- AS IS-john
Not sure about Toad but above code is parsing fine for me. |
 |
|
|
john20
Starting Member
30 Posts |
Posted - 2008-08-18 : 06:29:53
|
| Hi thanks for replying.I have changed the code now it is giving below error:PLS-00201: identifier 'NVARCHAR' must be declaredhow to declare that?below is the code:CREATE OR REPLACE PROCEDURE UserPerm (UserID NUMBER,Searchstr nvarchar)IS BEGINSelectd.*FromTree d inner join TreeACL a on d.DataID = a.DataID Whered.Name like SearchStr + '%'ANDa.RightID IN (Select ID From Children Where ChildID=UserID )ANDa.See > 0; END UserPerm;/-john |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-18 : 06:39:08
|
| Are you using SQL Server?If you use ORACLE, post your questions at www.orafaq.comMadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-18 : 06:40:50
|
quote: Originally posted by john20 Hi thanks for replying.I have changed the code now it is giving below error:PLS-00201: identifier 'NVARCHAR' must be declaredhow to declare that?below is the code:CREATE OR REPLACE PROCEDURE UserPerm (UserID NUMBER,Searchstr nvarchar)IS BEGINSelectd.*FromTree d inner join TreeACL a on d.DataID = a.DataID Whered.Name like SearchStr + '%'ANDa.RightID IN (Select ID From Children Where ChildID=UserID )ANDa.See > 0; END UserPerm;/-john
1.use int or float/real instead of number2.specify a length for nvarchar |
 |
|
|
|
|
|
|
|