Any SAPs out there?
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Posts 1 to 10 of 12
  1. #1

    TPAFKAk2p2

    mudskipper's Avatar
    Join Date
    Sep 2009
    Location
    Null island
    Posts
    24,762
    Thanks (Given)
    807
    Thanks (Received)
    1364
    Likes (Given)
    6235
    Likes (Received)
    4883

    Default Any SAPs out there?

    I've got a .net application that runs a sql script to populate a staging table. It's written to be generic - ODBC connection to the feed system(s), and the sql is read from a text file that is configured for each customer (using OdbcCommand - so the SQL is just a string). A bunch of parameters are passed in to cater for all scenarios.

    So far, the only systems we've interfaced with have been sql server. An ODBC connection doesn't support named parameters, so the (sql server) sql script looks something like

    DECLARE @period varchar(4) = ?;
    DECLARE @actuality varchar(2) = ?;

    SELECT sum(myamount) as amount from mytable where myperiod=@period and myactuality = @actuality;

    All works hunky dory

    I need to be able to do the same with a HANA database, but can't work out the variable syntax

    With the help of google, I've got -

    declare period varchar(4) := ?;
    declare actuality varchar(2) := ?;

    SELECT sum(MYAMOUNT) as amount from MYTABLE where MYPERIOD=eriod and MYACTUALITY=:actuality;

    But I get a syntax error on declare

    To add to the difficulty, I only have access to configure the system via a webex screenshare, where every mouse click or keystroke comes with a 2 second timelag, so it's not easy just to edit and try stuff.#

    How do I declare variables in HANA?

    Any clues?

  2. #2
    eek
    eek is offline

    bored now

    eek's Avatar
    Join Date
    Jun 2010
    Location
    😂
    Posts
    22,377
    Thanks (Given)
    241
    Thanks (Received)
    1206
    Likes (Given)
    1040
    Likes (Received)
    3561

    Default

    I believe from limited experience probably 10+ years ago and a very quick google search tells me you need something like...

    SET 'period' = '?';
    SET 'actuality' = '?';

    SELECT MYAMOUNT from MYTABLE where MYPERIOD=(select SESSION_CONTEXT('period') from DUMMY) and MYACTUALITY=(select SESSION_CONTEXT('actuality') from DUMMY);


    UNSET 'period';
    UNSET 'actuality';

    Good luck I expect you'll need it but its variation of the above...
    Last edited by eek; 11th July 2017 at 20:52.
    merely at clientco for the entertainment

  3. #3

    TPAFKAk2p2

    mudskipper's Avatar
    Join Date
    Sep 2009
    Location
    Null island
    Posts
    24,762
    Thanks (Given)
    807
    Thanks (Received)
    1364
    Likes (Given)
    6235
    Likes (Received)
    4883

    Default

    Cheers - I'll try the set thing.

  4. #4

    Respect my authoritah!

    NotAllThere's Avatar
    Join Date
    Aug 2007
    Location
    Far away from HMRC
    Posts
    17,461
    Thanks (Given)
    189
    Thanks (Received)
    789
    Likes (Given)
    1254
    Likes (Received)
    2694

    Default

    HANA SQLScript reference is here, in case you missed it.

    I don't know odbc, so I don't know what you mean by the ?, but your declares look correct. What is the exact syntax error? Are you able to post the exact script?

    SAP have a VM of HANA Express you could download to directly create your own SQL Scripts. Might speed things up.
    --drunk on abuse of power--

  5. #5

    TPAFKAk2p2

    mudskipper's Avatar
    Join Date
    Sep 2009
    Location
    Null island
    Posts
    24,762
    Thanks (Given)
    807
    Thanks (Received)
    1364
    Likes (Given)
    6235
    Likes (Received)
    4883

    Default

    Quote Originally Posted by NotAllThere View Post
    HANA SQLScript reference is here, in case you missed it.

    I don't know odbc, so I don't know what you mean by the ?, but your declares look correct. What is the exact syntax error? Are you able to post the exact script?

    SAP have a VM of HANA Express you could download to directly create your own SQL Scripts. Might speed things up.
    Ta muchly - that's probably what I need.

    Haven't got access at the moment, but IIRC the message was something along the lines of Syntax error on declare

  6. #6

    Faqqed Off

    TheFaQQer's Avatar
    Join Date
    Oct 2006
    Posts
    36,115
    Thanks (Given)
    380
    Thanks (Received)
    1283
    Likes (Given)
    3689
    Likes (Received)
    3200

    Default

    I'm disappointed.

    This thread seems to have a clearly defined problem, with enough information to seek accurate responses, with no need to pull teeth to get to the bottom of the problem. And the people who have replied seem to have some knowledge and how to solve the problem, without the OP resorting to laughing at them for not understanding and berating them for not having more than two years experience.

    This place really has gone down hill.
    Work in the public sector? You can read my FAQ here
    Click here to get 15% off your first year's IPSE membership
    Monday 27th November 1230-1330: IPSE Update on the Autumn Budget for contractors. Register here.

  7. #7

    Prof Cunning @ Oxford Uni

    WTFH's Avatar
    Join Date
    Nov 2012
    Posts
    10,217
    Thanks (Given)
    53
    Thanks (Received)
    1337
    Likes (Given)
    1055
    Likes (Received)
    3644

    Default

    I'm surprised that the answer to an SAP question could be condensed into a few lines and not the usual 500 pages of documentation that is normally required for their software.
    Strong and Stable Moderation

  8. #8

    TPAFKAk2p2

    mudskipper's Avatar
    Join Date
    Sep 2009
    Location
    Null island
    Posts
    24,762
    Thanks (Given)
    807
    Thanks (Received)
    1364
    Likes (Given)
    6235
    Likes (Received)
    4883

    Default

    Quote Originally Posted by WTFH View Post
    I'm surprised that the answer to an SAP question could be condensed into a few lines and not the usual 500 pages of documentation that is normally required for their software.
    It may not be answered yet

  9. #9

    Prof Cunning @ Oxford Uni

    WTFH's Avatar
    Join Date
    Nov 2012
    Posts
    10,217
    Thanks (Given)
    53
    Thanks (Received)
    1337
    Likes (Given)
    1055
    Likes (Received)
    3644

    Default

    Have you tried DROPTABLE ?
    Strong and Stable Moderation

  10. #10

    Double Godlike!


    Join Date
    Dec 2012
    Posts
    10,455
    Thanks (Given)
    767
    Thanks (Received)
    752
    Likes (Given)
    4986
    Likes (Received)
    2890

    Default

    Couldn't you use a similar method as the example here?

    https://help.sap.com/viewer/de2486ee...1ac6541b8.html

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.