Advertisement
Guest User

FEILKODER øverst i doc

a guest
Feb 27th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. FEILKODE:
  2. Error(10,19): PLS-00103: Encountered the symbol "INTO" when expecting one of the following: constant exception <an identifier> <a double-quoted delimited-identifier> table long double ref char time timestamp interval date binary national character nchar
  3. Error(11,1): PLS-00103: Encountered the symbol "LV_CHALLENGETYPE_TXT"
  4. Error(23,8): PLS-00103: Encountered the symbol "LV_ACCEPTANCEDATE_DATE" when expecting one of the following: into <a SQL statement>
  5. Error(24,1): PLS-00103: Encountered the symbol "AND" when expecting one of the following: . ( , % from
  6.  
  7.  
  8.  
  9.  
  10. /*
  11. ACCEPT_CHALLENGE_sp. Given a member email and a challenge identifier, insert a
  12. row into the CR_ACCEPTANCE table. The procedure will have to look up the member
  13. identifier that corresponds to the member indicated. If no value is provided
  14. for the acceptance date, use today’s date. The procedure should also insert a
  15. value of ‘active’ for the acceptance status. If the challenge is of type
  16. ‘immediate’, then the carbon amount for the challenge should be inserted into
  17. the acceptance carbon credit column. The procedure should check that there
  18. doesn't already exist another acceptance for this challenge that is active for
  19. the same member. (A member can't accept the same challenge twice at the same
  20. time.) If this is the case, the procedure should display an appropriate
  21. message.
  22. */
  23. create or replace procedure ACCEPT_CHALLENGE_sp (
  24. p_memberEmail IN VARCHAR2,
  25. p_challengeID IN INTEGER,
  26. p_acceptanceDate IN DATE
  27. ) AS
  28.  
  29. lv_memberEmail_txt CR_MEMBER.MEMBER_EMAIL;
  30. lv_challengeID_num CR.CHALLENGE.CHALLENGE_ID;
  31. lv_acceptanceDate_dat CR_ACCEPTANCE.ACCEPTANCE_DATE;
  32. lv_carbonAmt_num CR_CHALLENGE.CHALLENGE_CARBON_CREDIT;
  33. lv_challengeType_txt CR_CHALLENGE.CHALLENGE_TYPE;
  34. ex_alreadyaccepted_error EXCEPTION;
  35.  
  36. BEGIN
  37. SELECT MEMBER_EMAIL, ACCEPTANCE_STATUS
  38. INTO lv_memberEmail_txt, lv_acceptanceStatus_txt
  39. FROM CR_MEMBER, CR_ACCEPTANCE
  40. WHERE MEMBER_EMAIL = p_memberEmail;
  41.  
  42. IF p_memberEMAIL = lv_memberEmail_txt
  43. AND p_challengeID = lv_challengeID_num
  44. THEN
  45. INSERT lv_acceptanceDate_date INTO CR_ACCEPTANCE.ACCEPTANCE_DATE
  46. AND INSERT ('ACTIVE') INTO CR_ACCEPTANCE.ACCEPTANCE_STATUS
  47. AND lv_challengeType = ('immediate')
  48. THEN INSERT lv_challengeamt_num INTO CR_CHALLENGE_CARBON_CREDIT;
  49.  
  50. ELSIF
  51. p_memberEMAIL = lv_memberEmail_txt
  52. AND p_challengeID = lv_challengeID_num,
  53. AND P_acceptancedate =< 0 OR NULL,
  54. INSERT SYSTIMESTAMP INTO CR_ACCEPTANCE.ACCEPTANDE_DATE,
  55. AND INSERT ('ACTIVE') INTO CR_ACCEPTANCE.ACCEPTANCE_STATUS,
  56. AND lv_challengeType = ('immediate'),
  57. THEN INSERT lv_challengeamt_num INTO CR_CHALLENGE_CARBON_CREDIT;
  58.  
  59. ELSE
  60. p_memberEMAIL = lv_memberEmail_txt
  61. AND p_challengeID = lv_challengeID_num
  62. AND P_acceptancedate =< 0
  63. THEN INSERT DATE := SYSTIMESTAMP + 1 INTO CR_ACCEPTANCE.ACCEPTANDE_DATE;
  64. AND INSERT ('ACTIVE') INTO CR_ACCEPTANCE.ACCEPTANCE_STATUS
  65. AND lv_challengeType = ('immediate')
  66. THEN INSERT lv_challengeamt_num INTO CR_CHALLENGE_CARBON_CREDIT;
  67. AND CR_ACCEPTANCE.ACCEPTANCE_DATE = lv_acceptanceDate_date
  68. THEN RAISE ex_alreadyaccepted_error;
  69.  
  70.  
  71. EXCEPTION
  72. When ex_alreadyaccepted_error
  73. THEN DBMS_OUTPUT.PUT_LINE ('You have already accepted this challenge');
  74. ROLLBACK;
  75.  
  76. END ACCEPT_CHALLENGE_sp;
  77. /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement