yesare <email....@gmail.com> writes: > Thanks. > > I opened up ob-sql.el and read the code to see if I can figure it out. > > I think I have answered my first question. I wrote the following and hit > C-c C-c and I got the result set back. > > #+srcname: sampsql > #+begin_src sql :engine mysql :cmdline -h hostname -u username -pmypass -D > dbname > select * from tablename; > #+end_src > > regarding my 2nd question (reading orgtables), I am thinking that one can't > read orgtables in the same way as you read a db table. But you can use an > org table to extract data snippets to pass as variables to a sql or build a > dynamic sql. Is my understanding correct?
I'm not sure yet. Could you give a concrete example of something that you think is not possible? Then it shouldn't be too hard for us to say whether it is or isn't possible. > I was also experimenting on passing variables. I modified the above example > as shown below but I did not get any results I'm not the best person to help here (Eric Schulte and Seb Vauban would know more about using babel with sql) but your example does seem to work to me. If I put point on the block and issue C-c C-v C-v (org-babel-expand-src-block), then I see select * from tablename; but if I get rid of the :var then I see select * from $table; demonstrating that the :var substitution has been performed What do you get when you expand the block? Dan > > #+srcname: sampsql > #+begin_src sql :engine mysql :cmdline -h hostname -u username -pmypass -D > dbname :var table="tablename" > select * from $table; > #+end_src > > > > > > > > On Sun, Feb 13, 2011 at 3:08 AM, Bastien <bastien.gue...@wikimedia.fr>wrote: > >> Hi Yesare, >> >> I'm not familiar enough with Babel to give you useful guidance, >> but others on the list may help you. >> >> yesare <email....@gmail.com> writes: >> >> > I am trying to do two things. >> > >> > >> > 1. Query a mysql or oracle table and post results in orgtable format >> > 2. Select data from an existing orgtable in current buffer and do >> > further processing with them (example: insert them into Oracle). >> > >> > I am sorry if this is vague but I am just looking for some initial >> > guidance on how to get around. >> >> Can you post the code your tried? What you expected? What happened >> instead? This will help people to know where and why you're stuck. >> >> Thanks! >> >> -- >> Bastien >> > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode