CrossTab Example Failure / Question

(3 posts) (2 voices)

Tags:

No tags yet.

  1. Hi,
    I am new to mydbr and am trying to learn about the CrossTab functionality.

    I have successfully setup and executed several FilmList procedures and changes, but when I try to create a stored procedure for the CrossTab, I receive errors rom MySQL.

    The Transcript of the MySQL commands follows;

    [sql]mysql> delimiter ;;
    mysql> create procedure sp_DBR_ProdXtab ()
    -> select 'dbr.crosstab', 2;
    -> select 'dbr.colstyle', 4, mydbr_style('Diff colors with bg');
    -> select 'dbr.sum', 3,4,5;
    ->
    -> select RepArea as 'Reporting area',
    -> Period,
    -> last_year as 'Last year',
    -> this_year as 'This year',
    -> next_year as 'Next year'
    -> from mydb.ProductionSummary;
    -> end;;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';
    select 'dbr.colstyle', 4, mydbr_style('Diff colors with bg');
    select 'dbr.sum' at line 2
    mysql> delimiter ;

    Any advice would be appreciated.

  2. myDBR Team, Key Master

    Hi,
    Procedure body needs to be enclosed into begin-end. You seem to be missing the "begin". Other than that, it looks fine.

    Many users like to use MySQL Query Browser for editing the procedures. Might be easier when the procedure gets more logic into it.

    --
    myDBR Team

  3. Thanks, still working on my MySQL SP syntax skills.


Reply

You must log in to post.