2

I am using this simple query in Oracle SQL Developer to basically convert a value in Radians to Degrees but I get error at the function itself.

SELECT Degrees(1.571) as ANGLE FROM DUAL;

Error: Ora-00904: "DEGREES": invalid identifier 00904. 00000 - "%s: invalid identifier"

I checked Oracle documentation and a function called DEGREES does exist. I tried changing the query to convert DEGREES to RADIANS but same error.

Can someone please advise what's wrong here? The database I am connecting to is Oracle 12cR1.

Thanks in advance.

  • Please Post the link to the documentation you checked – miracle173 Aug 14 at 2:14
1

The DEGREES function you refer to is not in the Oracle database code. It is in the JavaDB which is also known as Derby. There is a construct in MySQL called DEGREES so this may be what you were thinking of.

You can make your own function like this

CREATE OR REPLACE FUNCTION radians_to_degree(p_radian IN NUMBER)
   RETURN NUMBER IS
BEGIN
   RETURN p_radian * 0.0174533;
END radians_to_degree;
| improve this answer | |
  • Thanks for your reply. If I were to convert a column value which is in Radians to Degrees, is there an easier way than having to use above function? – DK2014 Sep 13 '19 at 13:03
  • @DK2014 just use radian * 0.0174533 – kevinsky Sep 13 '19 at 13:05
  • thanks. I tried multiplying my radian value (1.571) which actually represents 90Deg, with * 0.0174533 but then it becomes small. But when I divide it then I get 90.01163103825637558513289750362395650106. – DK2014 Sep 13 '19 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.