in Education by
I tried to create following function: CREATE OR REPLACE function CATEGORYTEST(n in number) return VARCHAR(200) IS catname VARCHAR(200); BEGIN SELECT NAME AS PARENTCAT INTO CATNAME FROM CATEGORY_LANGUAGE WHERE CATEGORY_ID = ( SELECT PARENT_ID FROM CATEGORY WHERE ID = N AND CAT_TYPE_ID = 7 AND IS_ACTIVE = 1 AND IS_DELETED = 0 ) AND IS_ACTIVE = 1 AND IS_DELETED = 0; RETURN CATNAME; end; I am getting following error: Error(2,51): PLS-00103: Encountered the symbol "(" when expecting one of the following: . @ % ; is authid as cluster order using external character deterministic parallel_enable pipelined aggregate I had tried varchar2 also but getting same error. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Try this: CREATE OR REPLACE FUNCTION CATEGORYTEST( n IN NUMBER ) RETURN VARCHAR2 IS catname VARCHAR2(200); BEGIN SELECT NAME AS PARENTCAT INTO CATNAME FROM CATEGORY_LANGUAGE WHERE CATEGORY_ID = (SELECT PARENT_ID FROM CATEGORY WHERE ID = 'N' AND CAT_TYPE_ID = 7 AND IS_ACTIVE = 1 AND IS_DELETED = 0) AND IS_ACTIVE = 1 AND IS_DELETED = 0; RETURN CATNAME; end CATEGORYTEST; You needed single quotes around your string literals, VARCHAR changed to VARCHAR2 and some other small changes. BTW, your catname variable would be better declared as: catname CATEGORY_LANGUAGE.NAME%TYPE; You might also want to look into the return type of the function also being flexibly declared e.g.: RETURN CATEGORY_LANGUAGE.NAME%TYPE Hope it helps...

Related questions

0 votes
    I tried to create following function: CREATE OR REPLACE function CATEGORYTEST(n in number) return VARCHAR(200 ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
0 votes
    I tried to create following function: CREATE OR REPLACE function CATEGORYTEST(n in number) return VARCHAR(200 ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 16, 2022 in Education by JackTerrance
0 votes
    I have text stored in a database table, many short rows about 70-90 characters long fields. (of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    In my case, savepoint was set in Java and I am trying to rollback in a plsql procedure which was ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    I have text stored in a database table, many short rows about 70-90 characters long fields. (of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I have function that receives department name and an aggregation operation (average, maximum, minimum) and applies ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
0 votes
    _______________ has made PL/SQL code run faster without requiring any additional work on the part of the ... topic in chapter Query Processing Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    I am trying to make a a query against a table and am kind of stuck in constructing the WHERE ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    I have a dilemma, I'm using Java and Oracle and trying to keep queries on PL/SQL side. Everything ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 22, 2022 in Education by JackTerrance
0 votes
    I have a dilemma, I'm using Java and Oracle and trying to keep queries on PL/SQL side. Everything ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 21, 2022 in Education by JackTerrance
0 votes
    If no header is specified, the block is said to be an _______________ PL/SQL block. (a) Strong (b ... Answers, Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    We use ______________ name PL/SQL program objects and units. (a) Lexical Units (b) Literals (c) ... Answers, Database Interview Questions and Answers for Freshers and Experience...
asked Oct 11, 2021 in Education by JackTerrance
0 votes
    A line of PL/SQL text contains groups of characters known as (a) Lexical Units (b) Literals (c ... Query Optimization in portion Query Processing Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    How many types of cursors are available in PL/SQL?...
asked Dec 17, 2020 in Technology by JackTerrance
0 votes
    What are the cursor attributes used in PL/SQL?...
asked Dec 17, 2020 in Technology by JackTerrance
...