473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

fetching data from database after switching the user inside scritp

1
Hi,

I need to fetch the data from database and based on the user type i have to start some service based on user type from withing my script. I am getting some syntax error that i am not able to resolve. It will be much appreciated if some one can help me out. Error block is followed by code block.
Code block:

sqlquery="sqlPlus << ENDCOMM \
SET ECHO OFF; \
SPOOL user_details.dat ; \
SELECT DISTINCT UNIX_NAME,USER_TYPE from OPERATION_USERS where UNIX_NAME IS NOT NULL ; \
SPOOL OFF; \
ENDCOMM"

su ${UnixUser} -c "${sqlquery}" 1>>/var/log/acs 2>&1


Error block:

bash: -c: line 1: syntax error near unexpected token `('
bash: -c: line 1: `sqlPlus << ENDCOMM SET ECHO OFF; SPOOL user_details.dat ; SELECT DISTINCT UNIX_NAME,USER_TYPE from OPERATION_USERS where UNIX_NAME IS NOT NULL AND LENGTH(trim(UNIX_NAME))>0 and (UNIX_NAME,USER_TYPE) in(SELECT UNIX_NAME,max(USER_TYPE) from OPERATION_USERS where UNIX_NAME IS NOT NULL AND LENGTH(trim(UNIX_NAME))>0 group by UNIX_NAME) ; SPOOL OFF; ENDCOMM'
Oct 9 '07 #1
0 1274

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: ssb | last post by:
Hello, This may be very elementary, but, need help because I am new to access programming. (1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor ?) the values one by one and...
3
by: markaelkins | last post by:
I want to create a simple user interface to collect the following data and store the data in a SQL database…. Could someone please help me get started? Data to collect from user interface and...
2
by: asad | last post by:
hello, how ru all pls tell me how can i create DAL and how can i use it in my ASP.NET pages thanks
1
by: deepdata | last post by:
Hi, I am trying to fetch data from db2 (express version) database by calling stored procedure. I have tried to use both cursor and for loop but still i am getting error. --======Start...
9
by: Jenden0 | last post by:
I'm new to C# (and Microsoft in general) so this may be a simple problem, but I haven't been able to figure it out yet. I've got a database with a number of different tables and I want the user...
1
by: nasirmajor | last post by:
Dear All, im fetching record from database using datareader, and is displaying them in the textboxes. when user change the text fields and then presses the update button the record should be...
22
by: Sandman | last post by:
So, I have this content management system I've developed myself. The system has a solid community part where members can register and then participate in forums, write weblogs and a ton of other...
16
rpnew
by: rpnew | last post by:
Hello friends.... I'm developing one project in PHP-MySql on FC4..... I'm facing a problem here at one place. Let me describe it.... I've one page in php on which i'm generating a table...
9
by: Gordon | last post by:
I want to add a feature to a project I'm working on where i have multiple users set up on my Postgres database with varying levels of access. At the bare minimum there will be a login user who...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.