Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to excute with for and declare an variable? #4

Open
huuluan97 opened this issue May 14, 2020 · 3 comments
Open

How to excute with for and declare an variable? #4

huuluan97 opened this issue May 14, 2020 · 3 comments

Comments

@huuluan97
Copy link

huuluan97 commented May 14, 2020

Dear usausa,
I'm have an excute sql same here below. But when i run excute, the Smart-Net-Data-Accessor always display _42703: column "p0" does not exist . Please help me how to excute sql.

DO $$
DECLARE v_list text;
BEGIN
	v_list := TRIM (/*@list*/'')::text;

	FOR item IN SELECT unnest(STRING_TO_ARRAY(v_list , ','))ele
        LOOP
            INSERT INTO user(user_id, group_id, created_by) 
						 VALUES(
				/*@userId*/'',item ,/*@createdBy*/'');
				END LOOP; 
END;
$$;

Thank you so much.

@usausa
Copy link
Owner

usausa commented May 14, 2020

1st, check the auto-generated source file.
It is generated under the obj folder like obj\Debug\netcoreapp3.1\SmartDataAccessor.

@huuluan97
Copy link
Author

huuluan97 commented May 14, 2020

image

image

Hi usausa, i'm checked in images

@usausa
Copy link
Owner

usausa commented May 15, 2020

  1. Can that SQL and parameters be run using a raw ADO.NET or Dapper?
  2. Show me the whole auto-generated source.

Smart is a library that automatically generates source code using ADO.NET, so if you compare it with the raw code, you can check the problem.

@huuluan97 huuluan97 reopened this Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants